mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-03 18:04:08 +02:00
proper error response for not found demos
This commit is contained in:
parent
6ccf387d1e
commit
202d11fcc9
7 changed files with 61 additions and 9 deletions
|
|
@ -29,10 +29,8 @@ Flight::route('/do_upload', [$uploadController, 'upload']);
|
|||
|
||||
Flight::map('error', function (\Throwable $ex) {
|
||||
$code = 500;
|
||||
if ($ex instanceof InvalidKeyException) {
|
||||
$code = 401;
|
||||
} elseif ($ex instanceof InvalidHashException) {
|
||||
$code = 412;
|
||||
if ($ex->getCode()) {
|
||||
$code = $ex->getCode();
|
||||
}
|
||||
/** @var Response $response */
|
||||
$response = Flight::response()->status($code);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue