| Conditions | 3 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function render($request, Exception $e) |
||
| 17 | { |
||
| 18 | if (true === app()->isDownForMaintenance()) { |
||
|
|
|||
| 19 | return response()->json([ |
||
| 20 | 'error' => [ |
||
| 21 | 'code' => 503, |
||
| 22 | 'message' => 'Service is down for scheduled maintenance. Be right back!' |
||
| 23 | ] |
||
| 24 | ], 503); |
||
| 25 | } |
||
| 26 | |||
| 27 | if (true === $e instanceof ApiInternalCallValidationException) { |
||
| 28 | $response = response([ |
||
| 29 | 'error' => [ |
||
| 30 | 'code' => 215, |
||
| 31 | 'message' => 'Validation failed'] |
||
| 32 | ], 400); |
||
| 33 | |||
| 34 | return $response->withException($e); |
||
| 35 | } |
||
| 36 | |||
| 37 | return (new NappApiHandler($e))->render(); |
||
| 38 | } |
||
| 40 |