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) { // log Log::error($exception->getMessage()); // mail? try { $email = env('SITE_OWNER'); $user = $request->user(); $args = [ 'errorMessage' => $exception->getMessage(), 'stacktrace' => $exception->getTraceAsString(), 'file' => $exception->getFile(), 'line' => $exception->getLine(), 'code' => $exception->getCode(), 'loggedIn' => !is_null($user), 'user' => $user, 'ip' => $request->ip(), ]; Mail::send( ['emails.error-html', 'emails.error'], $args, function (Message $message) use ($email) { if ($email != 'mail@example.com') { $message->to($email, $email)->subject('Caught an error in Firely III.'); } } ); } catch (Swift_TransportException $e) { // could also not mail! :o Log::error($e->getMessage()); } } parent::report($exception); } }