Skip to content

Commit 3edf744

Browse files
committed
fix: Adapt exception handling for Laravel 10
1 parent 1b67781 commit 3edf744

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

src/App/Traits/ExceptionNotificationHandlerTrait.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,17 @@ trait ExceptionNotificationHandlerTrait
2424
];
2525

2626
/**
27-
* Report or log an exception.
28-
*
29-
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
30-
*
31-
* @return void
27+
* Register the exception handling callbacks for the application.
3228
*/
33-
public function report(Throwable $e)
29+
public function register(): void
3430
{
35-
$enableEmailExceptions = config('exceptions.emailExceptionEnabled');
36-
37-
if ($enableEmailExceptions === '') {
38-
$enableEmailExceptions = config('exceptions.emailExceptionEnabledDefault');
39-
}
31+
$this->reportable(function (Throwable $e) {
32+
$enableEmailExceptions = config('exceptions.emailExceptionEnabled', true);
4033

41-
if ($enableEmailExceptions) {
42-
if ($this->shouldReport($e)) {
34+
if ($enableEmailExceptions && $this->shouldReport($e)) {
4335
$this->sendEmail($e);
4436
}
45-
}
46-
47-
parent::report($e);
37+
});
4838
}
4939

5040
/**

0 commit comments

Comments
 (0)