mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-03 18:04:08 +02:00
dont try to set invalid status codes
This commit is contained in:
parent
5b3a66a8c1
commit
b06cf67a70
2 changed files with 12 additions and 5 deletions
|
|
@ -74,8 +74,12 @@ Flight::map('error', function (\Throwable $ex) {
|
|||
if ($ex->getCode()) {
|
||||
$code = $ex->getCode();
|
||||
}
|
||||
/** @var Response $response */
|
||||
$response = Flight::response()->status($code);
|
||||
$response = Flight::response();
|
||||
if (array_key_exists($code, Response::$codes)) {
|
||||
$response->status($code);
|
||||
} else {
|
||||
$response->status(500);
|
||||
}
|
||||
$response->write($ex->getMessage())->send();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue