Browse Source

refactor Exception::toArrayRecursive().

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
9e9b3548db
  1. 11
      framework/yii/base/Exception.php

11
framework/yii/base/Exception.php

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

Loading…
Cancel
Save