Browse files

* cleanup

  • Loading branch information...
1 parent 1f1d204 commit 2b9a1724cf2e5d3b2c4cf287efa125a762535271 @nicolas-grekas committed Aug 24, 2012
Showing with 11 additions and 10 deletions.
  1. +8 −7 class/Patchwork/PHP/ErrorHandler.php
  2. +3 −3 class/Patchwork/PHP/Logger.php
View
15 class/Patchwork/PHP/ErrorHandler.php
@@ -242,16 +242,19 @@ function handleError($type, $message, $file, $line, $scope, $trace_offset = 0, $
function handleException(\Exception $e, $log_time = 0)
{
- $r = array($this->thrownErrors, $this->scopedErrors, $e instanceof RecoverableErrorInterface ? $e->getSeverity() : E_ERROR);
- $this->scopedErrors |= $r[2];
+ $thrown = $this->thrownErrors;
+ $scoped = $this->scopedErrors;
+ $type = $e instanceof RecoverableErrorException ? $e->getSeverity() : E_ERROR;
+ $this->scopedErrors |= $type;
$this->thrownErrors = 0;
$this->handleError(
- $r[2], "Uncaught exception: " . $e->getMessage(),
+ $type, "Uncaught exception: " . $e->getMessage(),
$e->getFile(), $e->getLine(),
array($e),
-1, $log_time
);
- list($this->thrownErrors, $this->scopedErrors) = $r;
+ $this->thrownErrors = $thrown;
+ $this->scopedErrors = $scoped;
}
function handleLastError($e)
@@ -268,9 +271,7 @@ function getLogger()
}
}
-class RecoverableErrorException extends \ErrorException implements RecoverableErrorInterface
+class RecoverableErrorException extends \ErrorException
{
public $traceOffset = -1, $scope = null;
}
-
-interface RecoverableErrorInterface {}
View
6 class/Patchwork/PHP/Logger.php
@@ -112,10 +112,10 @@ function castException($e)
{
$a = (array) $e;
- $a["\0Exception\0trace"] = $this->filterTrace($a["\0Exception\0trace"], $e instanceof RecoverableErrorInterface ? $e->traceOffset : 0, 1);
+ $a["\0Exception\0trace"] = $this->filterTrace($a["\0Exception\0trace"], $e instanceof RecoverableErrorException ? $e->traceOffset : 0, 1);
if (null === $a["\0Exception\0trace"]) unset($a["\0Exception\0trace"]);
- if ($e instanceof RecoverableErrorInterface) unset($a['traceOffset']);
- if ($e instanceof RecoverableErrorInterface && !isset($a['scope'])) unset($a['scope']);
+ if ($e instanceof RecoverableErrorException) unset($a['traceOffset']);
+ if ($e instanceof RecoverableErrorException && !isset($a['scope'])) unset($a['scope']);
if (empty($a["\0Exception\0previous"])) unset($a["\0Exception\0previous"]);
if ($e instanceof \ErrorException && isset(self::$errorTypes[$a["\0*\0severity"]])) $a["\0*\0severity"] = self::$errorTypes[$a["\0*\0severity"]];
unset($a["\0Exception\0string"], $a['xdebug_message'], $a['__destructorException']);

0 comments on commit 2b9a172

Please sign in to comment.