Loading src/Exceptions/Handler/AppExceptionHandler.php +6 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,12 @@ class AppExceptionHandler extends ExceptionHandler $this->stdoutLogger->error($msg); $this->logger->error($msg); $this->stdoutLogger->error($throwable->getTraceAsString()); return $response->withHeader("Server", "H5Q-OA")->withStatus(500)->withBody(new SwooleStream($msg)); // 格式化输出 $data = json_encode([ 'code' => $throwable->getCode() ?: 400, 'msg' => $throwable->getMessage(), ], JSON_UNESCAPED_UNICODE); return $response->withAddedHeader('content-type', 'application/json')->withBody(new SwooleStream($data)); } public function isValid(Throwable $throwable): bool Loading Loading
src/Exceptions/Handler/AppExceptionHandler.php +6 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,12 @@ class AppExceptionHandler extends ExceptionHandler $this->stdoutLogger->error($msg); $this->logger->error($msg); $this->stdoutLogger->error($throwable->getTraceAsString()); return $response->withHeader("Server", "H5Q-OA")->withStatus(500)->withBody(new SwooleStream($msg)); // 格式化输出 $data = json_encode([ 'code' => $throwable->getCode() ?: 400, 'msg' => $throwable->getMessage(), ], JSON_UNESCAPED_UNICODE); return $response->withAddedHeader('content-type', 'application/json')->withBody(new SwooleStream($data)); } public function isValid(Throwable $throwable): bool Loading