view('errors.FireflyException', ['exception' => $exception, 'debug' => $isDebug], 500); } return parent::render($request, $exception); } /** * Report or log an exception. * * This is a great spot to send exceptions to Sentry, Bugsnag, etc. * * @param Exception $exception * * @return void */ public function report(Exception $exception) { if ($exception instanceof FireflyException || $exception instanceof ErrorException) { $userData = [ 'id' => 0, 'email' => 'unknown@example.com', ]; if (Auth::check()) { $userData['id'] = Auth::user()->id; $userData['email'] = Auth::user()->email; } $data = [ 'class' => get_class($exception), 'errorMessage' => $exception->getMessage(), 'time' => date('r'), 'stackTrace' => $exception->getTraceAsString(), 'file' => $exception->getFile(), 'line' => $exception->getLine(), 'code' => $exception->getCode(), ]; // create job that will mail. $job = new MailError($userData, env('SITE_OWNER'), Request::ip(), $data); dispatch($job); } parent::report($exception); } }