From effe92a05c339feda37b336b2c45f46c776958bc Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 3 Apr 2021 12:32:29 +0200 Subject: [PATCH] Make sure the email error mails everything. --- app/Exceptions/Handler.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index f0a73615d8..a5923fee24 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -32,6 +32,7 @@ use FireflyIII\Jobs\MailError; use Illuminate\Auth\AuthenticationException; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Illuminate\Http\Request; +use Illuminate\Support\Arr; use Illuminate\Validation\ValidationException as LaravelValidationException; use League\OAuth2\Server\Exception\OAuthServerException; use Log; @@ -131,9 +132,10 @@ class Handler extends ExceptionHandler public function report(Throwable $e) { $doMailError = config('firefly.send_error_message'); - if ($this->shouldntReport($e) || !$doMailError) { + if ($this->shouldntReportLocal($e) || !$doMailError) { Log::info('Will not report on this error.'); parent::report($e); + return; } $userData = [ @@ -165,4 +167,20 @@ class Handler extends ExceptionHandler parent::report($e); } + + /** + * @param Throwable $e + * + * @return bool + */ + private function shouldntReportLocal(Throwable $e): bool + { + return !is_null( + Arr::first( + $this->dontReport, function ($type) use ($e) { + return $e instanceof $type; + } + ) + ); + } }