diff options
Diffstat (limited to 'src/Errors')
| -rwxr-xr-x | src/Errors/NotFoundError.php | 19 | ||||
| -rwxr-xr-x | src/Errors/UnauthorizedError.php | 4 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/Errors/NotFoundError.php b/src/Errors/NotFoundError.php new file mode 100755 index 0000000..a128509 --- /dev/null +++ b/src/Errors/NotFoundError.php @@ -0,0 +1,19 @@ +<?php + +namespace App\Errors; + +use Matrix\Enums\ErrorCode; +use Symfony\Component\HttpFoundation\Response; + +class NotFoundError extends Exception +{ + public function __construct(string $message = "404") + { + parent::__construct(ErrorCode::NOT_FOUND, $message, Response::HTTP_NOT_FOUND); + } + + public function getAdditionalData(): array + { + return []; + } +} diff --git a/src/Errors/UnauthorizedError.php b/src/Errors/UnauthorizedError.php index cd9981f..e164597 100755 --- a/src/Errors/UnauthorizedError.php +++ b/src/Errors/UnauthorizedError.php @@ -7,9 +7,9 @@ use Symfony\Component\HttpFoundation\Response; class UnauthorizedError extends Exception { - public function __construct() + public function __construct(string $message = "Unauthorized") { - parent::__construct(ErrorCode::FORBIDDEN, "Unauthorized", Response::HTTP_UNAUTHORIZED); + parent::__construct(ErrorCode::FORBIDDEN, $message, Response::HTTP_UNAUTHORIZED); } public function getAdditionalData(): array |
