From da879d3c680c9293e97c67e9693066dbfd9a0b14 Mon Sep 17 00:00:00 2001 From: walkor Date: Sat, 28 Jan 2023 15:09:38 +0800 Subject: [PATCH] $this->_debug => $this->debug --- src/plugin/admin/app/exception/Handler.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugin/admin/app/exception/Handler.php b/src/plugin/admin/app/exception/Handler.php index 8f76b9f..63da273 100644 --- a/src/plugin/admin/app/exception/Handler.php +++ b/src/plugin/admin/app/exception/Handler.php @@ -27,13 +27,14 @@ class Handler extends \support\exception\Handler public function render(Request $request, Throwable $exception): Response { $code = $exception->getCode(); + $debug = $this->_debug ?? $this->debug; if ($request->expectsJson()) { - $json = ['code' => $code ? $code : 500, 'msg' => $this->_debug ? $exception->getMessage() : 'Server internal error', 'type' => 'failed']; - $this->_debug && $json['traces'] = (string)$exception; + $json = ['code' => $code ?: 500, 'msg' => $debug ? $exception->getMessage() : 'Server internal error', 'type' => 'failed']; + $debug && $json['traces'] = (string)$exception; return new Response(200, ['Content-Type' => 'application/json'], \json_encode($json, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); } - $error = $this->_debug ? \nl2br((string)$exception) : 'Server internal error'; + $error = $debug ? \nl2br((string)$exception) : 'Server internal error'; return new Response(500, [], $error); } }