mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-04 02:14:06 +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
|
|
@ -22,4 +22,7 @@ declare(strict_types=1);
|
|||
namespace Demostf\API\Error;
|
||||
|
||||
class InvalidHashException extends \Exception {
|
||||
public function __construct(string $message) {
|
||||
parent::__construct($message, 412);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,4 +22,7 @@ declare(strict_types=1);
|
|||
namespace Demostf\API\Error;
|
||||
|
||||
class InvalidKeyException extends \Exception {
|
||||
public function __construct(string $message) {
|
||||
parent::__construct($message, 401);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
30
src/Error/NotFoundException.php
Normal file
30
src/Error/NotFoundException.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2020 Robin Appelman <robin@icewind.nl>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Demostf\API\Error;
|
||||
|
||||
class NotFoundException extends \Exception {
|
||||
public function __construct(string $message) {
|
||||
parent::__construct($message, 404);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue