|
|
@ -39,21 +39,12 @@ class Exception extends \Exception implements Arrayable |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected function toArrayRecursive($exception) |
|
|
|
protected function toArrayRecursive($exception) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ($exception instanceof self) { |
|
|
|
|
|
|
|
$array = array( |
|
|
|
$array = array( |
|
|
|
'type' => get_class($exception), |
|
|
|
'type' => get_class($exception), |
|
|
|
'name' => $exception->getName(), |
|
|
|
'name' => $exception instanceof self ? $exception->getName() : 'Exception', |
|
|
|
'message' => $exception->getMessage(), |
|
|
|
'message' => $exception->getMessage(), |
|
|
|
'code' => $exception->getCode(), |
|
|
|
'code' => $exception->getCode(), |
|
|
|
); |
|
|
|
); |
|
|
|
} else { |
|
|
|
|
|
|
|
$array = array( |
|
|
|
|
|
|
|
'type' => get_class($exception), |
|
|
|
|
|
|
|
'name' => 'Exception', |
|
|
|
|
|
|
|
'message' => $exception->getMessage(), |
|
|
|
|
|
|
|
'code' => $exception->getCode(), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (($prev = $exception->getPrevious()) !== null) { |
|
|
|
if (($prev = $exception->getPrevious()) !== null) { |
|
|
|
$array['previous'] = $this->toArrayRecursive($prev); |
|
|
|
$array['previous'] = $this->toArrayRecursive($prev); |
|
|
|
} |
|
|
|
} |
|
|
|