1 | <?php |
||
22 | trait ExceptionHelperTrait |
||
23 | { |
||
24 | /** |
||
25 | * Returns a BadRequestHttpException. |
||
26 | * |
||
27 | * This will result in a 400 response code. |
||
28 | * |
||
29 | * @param string $message A message |
||
30 | * @param \Exception|null $previous The previous exception |
||
31 | * |
||
32 | * @return BadRequestHttpException |
||
33 | */ |
||
34 | protected function createBadRequestException($message = 'Wrong Request', \Exception $previous = null) |
||
38 | |||
39 | /** |
||
40 | * Returns a UnauthorizedHttpException. |
||
41 | * |
||
42 | * This will result in a 401 response code. |
||
43 | * |
||
44 | * @param string $message A message |
||
45 | * @param \Exception|null $previous The previous exception |
||
46 | * |
||
47 | * @return UnauthorizedHttpException |
||
48 | */ |
||
49 | protected function createUnauthorizedException($message = 'Invalid Credentials', \Exception $previous = null) |
||
53 | |||
54 | /** |
||
55 | * Returns a ServerInternalErrorException. |
||
56 | * |
||
57 | * This will result in a 500 response code. |
||
58 | * |
||
59 | * @param string $message A message |
||
60 | * @param \Exception|null $previous The previous exception |
||
61 | * |
||
62 | * @return ServerInternalErrorException |
||
63 | */ |
||
64 | protected function createInternalServerErrorException($message = 'Internal Server Error', \Exception $previous = null) |
||
68 | } |
||
69 |