Skip to content

Commit 01b6d7c

Browse files
authored
Catch Errors in middleware
1 parent 4774e1b commit 01b6d7c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Middleware/Debugbar.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<?php namespace Barryvdh\Debugbar\Middleware;
22

3+
use Error;
34
use Closure;
45
use Exception;
56
use Illuminate\Http\Request;
67
use Barryvdh\Debugbar\LaravelDebugbar;
78
use Illuminate\Contracts\Container\Container;
89
use Illuminate\Contracts\Debug\ExceptionHandler;
10+
use Symfony\Component\Debug\Exception\FatalThrowableError;
911

1012
class Debugbar
1113
{
@@ -49,6 +51,9 @@ public function handle($request, Closure $next)
4951
$response = $next($request);
5052
} catch (Exception $e) {
5153
$response = $this->handleException($request, $e);
54+
} catch (Error $error) {
55+
$e = new FatalThrowableError($error);
56+
$response = $this->handleException($request, $e);
5257
}
5358

5459
// Modify the response to add the Debugbar

0 commit comments

Comments
 (0)