reportable(function (\Throwable $e) { Integration::captureUnhandledException($e); if ($e instanceof CafelApiImageFetchException) { $this->reportCafelApiImageErrorException($e); return; } }); } /** * Report Cafel exception image. * * @param CafelApiImageFetchException $exception * @return void */ private function reportCafelApiImageErrorException(CafelApiImageFetchException $exception): void { $dest = config('exception-handler.invalidCafelImage', config('mail.from.address')); try { if ($dest and config('exception-handler.enableMaiLog')) { Mail::send([ 'html' => 'mails.invalidCafelImage' ], [ 'appName' => config('app.name'), 'emessage' => $exception->getMessage(), ], function ($m) use ($dest) { /** @var \Illuminate\Mail\Message $m */ $m->to( $dest, sprintf('%s Exception Handler', config('app.name')) )->subject(sprintf( '%s : Api Cafel, l\'image va ĂȘtre ignorĂ© car elle est invalide.', config('app.name') )); }); } } catch (\Exception $e) { Log::critical('Handler could not send Exception email', ['exception' => $e]); } //end try } }