Skip to content

Commit

Permalink
更新:优化云日志
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuchunshu committed Jan 18, 2023
1 parent b723fb4 commit 6f2b8e7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/Exception/Handler/AppExceptionHandler.php
Expand Up @@ -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
Expand All @@ -37,13 +38,14 @@ 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 <a href="' . url('/admin/server/logger/' . $log_id . '.html') . '">' . url('/admin/server/logger/' . $log_id . '.html') . '</a>'));
}

public function isValid(Throwable $throwable): bool
{
return true;
return !$throwable instanceof UnauthorizedException;
}
}

0 comments on commit 6f2b8e7

Please sign in to comment.