feat : 500

This commit is contained in:
2024-11-12 16:34:06 +08:00
parent 884b0d0b78
commit 4145e082b0

View File

@@ -34,11 +34,11 @@ class AppExceptionHandler extends ExceptionHandler
$this->log->error(sprintf('%s[%s] in %s', $throwable->getMessage(), $throwable->getLine(), $throwable->getFile())); $this->log->error(sprintf('%s[%s] in %s', $throwable->getMessage(), $throwable->getLine(), $throwable->getFile()));
$this->log->error($throwable->getTraceAsString()); $this->log->error($throwable->getTraceAsString());
$result = $this->return->error('Internal Server Error.'); // $result = $this->return->error('Internal Server Error.');
return $response->withHeader("Content-Type", "application/json") // return $response->withHeader("Content-Type", "application/json")
->withStatus(200) // ->withStatus(200)
->withBody(new SwooleStream(json_encode($result, JSON_UNESCAPED_UNICODE))); // ->withBody(new SwooleStream(json_encode($result, JSON_UNESCAPED_UNICODE)));
// return $response->withHeader('Server', 'Hyperf')->withStatus(500)->withBody(new SwooleStream('Internal Server Error.')); return $response->withHeader('Server', 'Hyperf')->withStatus(500)->withBody(new SwooleStream('Internal Server Error.'));
} }
public function isValid(Throwable $throwable): bool public function isValid(Throwable $throwable): bool