This commit is contained in:
Aether
2025-09-25 09:16:42 +08:00
parent 25aa56439a
commit 0ca8d067c6

View File

@@ -1,20 +1,13 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace App\Exception\Handler; namespace App\Exception\Handler;
use Hyperf\Contract\StdoutLoggerInterface; use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\ExceptionHandler\ExceptionHandler; use Hyperf\ExceptionHandler\ExceptionHandler;
use Hyperf\HttpMessage\Stream\SwooleStream; use Hyperf\HttpMessage\Stream\SwooleStream;
use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Throwable; use Throwable;
@@ -24,7 +17,7 @@ class AppExceptionHandler extends ExceptionHandler
{ {
} }
public function handle(Throwable $throwable, ResponseInterface $response) public function handle(Throwable $throwable, ResponseInterface $response): MessageInterface|ResponseInterface
{ {
$this->logger->error(sprintf('%s[%s] in %s', $throwable->getMessage(), $throwable->getLine(), $throwable->getFile())); $this->logger->error(sprintf('%s[%s] in %s', $throwable->getMessage(), $throwable->getLine(), $throwable->getFile()));
$this->logger->error($throwable->getTraceAsString()); $this->logger->error($throwable->getTraceAsString());