Skip to content

Commit

Permalink
clean up throw
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Sep 21, 2018
1 parent 5e46e43 commit 49e8432
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions src/HeroTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function phpFatalErrorHandler($buffer): string
return $buffer;
}

if (0 === strpos($error['message'], 'Uncaught') && $error['type'] !== \E_ERROR) {
if (0 === strpos($error['message'], 'Uncaught')) {
return $buffer;
}

Expand All @@ -43,29 +43,25 @@ public function execOnShutdown() : void
return;
}

if (0 === strpos($error['message'], 'Uncaught') && $error['type'] !== \E_ERROR) {
if (0 === strpos($error['message'], 'Uncaught')) {
return;
}

$errorException = new ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line']);
try {
if (property_exists($this, 'request')) {
$result = $this->exceptionError($errorException, $this->request);
$this->result = (string) $result->getBody();

return;
}

if (property_exists($this, 'mvcEvent')) {
ob_start();
$this->mvcEvent->setParam('exception', $errorException);
$this->exceptionError($this->mvcEvent);
$this->result = ob_get_clean();

return;
}
} catch (ErrorException $t) {
throw $t;
if (property_exists($this, 'request')) {
$result = $this->exceptionError($errorException, $this->request);
$this->result = (string) $result->getBody();

return;
}

if (property_exists($this, 'mvcEvent')) {
ob_start();
$this->mvcEvent->setParam('exception', $errorException);
$this->exceptionError($this->mvcEvent);
$this->result = ob_get_clean();

return;
}
}

Expand Down

0 comments on commit 49e8432

Please sign in to comment.