diff --git a/app/Exception/Handler/BusinessExceptionHandler.php b/app/Exception/Handler/BusinessExceptionHandler.php index cfc3f8b..19cc341 100644 --- a/app/Exception/Handler/BusinessExceptionHandler.php +++ b/app/Exception/Handler/BusinessExceptionHandler.php @@ -17,6 +17,7 @@ use Hyperf\Contract\StdoutLoggerInterface; use Hyperf\Di\Exception\CircularDependencyException; use Hyperf\ExceptionHandler\ExceptionHandler; +use Hyperf\HttpMessage\Exception\HttpException; use Psr\Container\ContainerInterface; use Psr\Http\Message\ResponseInterface; use Throwable; @@ -48,6 +49,8 @@ public function __construct(ContainerInterface $container) public function handle(Throwable $throwable, ResponseInterface $response) { switch (true) { + case $throwable instanceof HttpException: + return $this->response->handleException($throwable); case $throwable instanceof BusinessException: $this->logger->warning(format_throwable($throwable)); return $this->response->fail($throwable->getCode(), $throwable->getMessage());