Skip to content

Commit

Permalink
Handle errors with no link to previous exception
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Jan 3, 2018
1 parent a33bdcf commit 7793e90
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ExceptionHandlerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function filterErrorResponse(\Exception $exception, $request, $response)
}
}
if (!$request->expectsJson() && $exception instanceof LocatedException) {
$className = get_class($exception->getPrevious());
$className = get_class($exception->getPrevious() ?: $exception);
$location = $exception->getLocation();
$line = $location->getLine();
$offset = $location->getOffset();
Expand Down Expand Up @@ -78,7 +78,7 @@ public function filterErrorResponse(\Exception $exception, $request, $response)
(<\/pre>)
/x', function ($match) use ($path, $line) {
$code = array();
$source = explode("\n", file_get_contents($path));
$source = explode("\n", @file_get_contents($path));
$before = 19;
$after = 7;
$start = max(0, $line - $before);
Expand Down

0 comments on commit 7793e90

Please sign in to comment.