Skip to content

Commit 98d8425

Browse files
authored
Merge pull request #29564 from sschlein/allow-custom-whoops-handler
[5.8] Allow custom Whoops handlers
2 parents 3069091 + 3a65408 commit 98d8425

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/Illuminate/Foundation/Exceptions/Handler.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Illuminate\Support\Facades\Auth;
1414
use Illuminate\Support\Facades\View;
1515
use Illuminate\Support\ViewErrorBag;
16+
use Whoops\Handler\HandlerInterface;
1617
use Illuminate\Http\RedirectResponse;
1718
use Illuminate\Auth\AuthenticationException;
1819
use Illuminate\Contracts\Container\Container;
@@ -24,6 +25,7 @@
2425
use Symfony\Component\Debug\Exception\FlattenException;
2526
use Illuminate\Database\Eloquent\ModelNotFoundException;
2627
use Symfony\Component\HttpKernel\Exception\HttpException;
28+
use Illuminate\Contracts\Container\BindingResolutionException;
2729
use Symfony\Component\Console\Application as ConsoleApplication;
2830
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
2931
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -350,7 +352,11 @@ protected function renderExceptionWithWhoops(Exception $e)
350352
*/
351353
protected function whoopsHandler()
352354
{
353-
return (new WhoopsHandler)->forDebug();
355+
try {
356+
return app(HandlerInterface::class);
357+
} catch (BindingResolutionException $e) {
358+
return (new WhoopsHandler)->forDebug();
359+
}
354360
}
355361

356362
/**

0 commit comments

Comments
 (0)