From 6f2b8e7142f550b6119543dc66ec5c65605bcfa3 Mon Sep 17 00:00:00 2001 From: zhuchunshu Date: Wed, 18 Jan 2023 23:11:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0:=E4=BC=98=E5=8C=96=E4=BA=91?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Exception/Handler/AppExceptionHandler.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Exception/Handler/AppExceptionHandler.php b/app/Exception/Handler/AppExceptionHandler.php index 3df36c799..a1ac66dc9 100755 --- a/app/Exception/Handler/AppExceptionHandler.php +++ b/app/Exception/Handler/AppExceptionHandler.php @@ -15,6 +15,7 @@ use Hyperf\HttpMessage\Stream\SwooleStream; use Hyperf\Utils\Str; use Psr\Http\Message\ResponseInterface; +use Qbhy\HyperfAuth\Exception\UnauthorizedException; use Throwable; class AppExceptionHandler extends ExceptionHandler @@ -37,6 +38,7 @@ public function handle(Throwable $throwable, ResponseInterface $response) 'message' => $throwable->getMessage(), 'line' => $throwable->getLine(), 'file' => $throwable->getFile(), + 'link' => url(request()->getPathInfo()), ]); $log_id = $log['_id']; return $response->withHeader('Server', 'SForum')->withStatus(500)->withBody(new SwooleStream('Internal Server Error. log in ' . url('/admin/server/logger/' . $log_id . '.html') . '')); @@ -44,6 +46,6 @@ public function handle(Throwable $throwable, ResponseInterface $response) public function isValid(Throwable $throwable): bool { - return true; + return !$throwable instanceof UnauthorizedException; } }