| @@ 31-44 (lines=14) @@ | ||
| 28 | 'message' => 'Slim Application Error', |
|
| 29 | ]; |
|
| 30 | ||
| 31 | if ($this->displayErrorDetails) { |
|
| 32 | $error['exception'] = []; |
|
| 33 | ||
| 34 | do { |
|
| 35 | $error['exception'][] = [ |
|
| 36 | 'type' => get_class($exception), |
|
| 37 | 'code' => $exception->getCode(), |
|
| 38 | 'message' => $exception->getMessage(), |
|
| 39 | 'file' => $exception->getFile(), |
|
| 40 | 'line' => $exception->getLine(), |
|
| 41 | 'trace' => explode("\n", $exception->getTraceAsString()), |
|
| 42 | ]; |
|
| 43 | } while ($exception = $exception->getPrevious()); |
|
| 44 | } |
|
| 45 | ||
| 46 | return json_encode($error, JSON_PRETTY_PRINT); |
|
| 47 | } |
|
| @@ 18-31 (lines=14) @@ | ||
| 15 | 'message' => 'Slim Application Error', |
|
| 16 | ]; |
|
| 17 | ||
| 18 | if ($displayErrorDetails) { |
|
| 19 | $json['error'] = []; |
|
| 20 | ||
| 21 | do { |
|
| 22 | $json['error'][] = [ |
|
| 23 | 'type' => get_class($error), |
|
| 24 | 'code' => $error->getCode(), |
|
| 25 | 'message' => $error->getMessage(), |
|
| 26 | 'file' => $error->getFile(), |
|
| 27 | 'line' => $error->getLine(), |
|
| 28 | 'trace' => explode("\n", $error->getTraceAsString()), |
|
| 29 | ]; |
|
| 30 | } while ($error = $error->getPrevious()); |
|
| 31 | } |
|
| 32 | ||
| 33 | return json_encode($json, JSON_PRETTY_PRINT); |
|
| 34 | } |
|