1 | <?php namespace App\Exceptions; |
||
6 | class RepositoryException extends Exception |
||
7 | { |
||
8 | // Server Side |
||
9 | const DATABASE_ERROR = 11; |
||
10 | |||
11 | // Client side |
||
12 | const INCORRECT_PARAMETER = 21; |
||
13 | const VALIDATION_FAILED = 22; |
||
14 | const RESOURCE_NOT_FOUND = 23; |
||
15 | const RESOURCE_DENIED = 24; |
||
16 | |||
17 | // Matching HTTP status |
||
18 | private static $httpStatus = [self::DATABASE_ERROR => 503, |
||
19 | self::INCORRECT_PARAMETER => 400, |
||
20 | self::VALIDATION_FAILED => 400, |
||
21 | self::RESOURCE_NOT_FOUND => 404, |
||
22 | self::RESOURCE_DENIED => 403]; |
||
23 | |||
24 | public function APIFormat() |
||
28 | |||
29 | public function jsonResponse() |
||
35 | |||
36 | } |
||
37 |