Ejemplo n.º 1
0
 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof \UnknownPlayerException) {
         Bugsnag::notifyException($e);
         return response()->view('error', ['error' => $e->getMessage()]);
     }
     if ($e instanceof \DestinyException) {
         Bugsnag::notifyException($e);
         return response()->view('error', ['error' => $e->getMessage(), 'bungie' => true]);
     }
     if ($e instanceof \DestinyLegacyPlatformException) {
         return response()->view('error', ['error' => $e->getMessage(), 'bungie' => true]);
     }
     if (\Config::get('app.debug')) {
         \Session::flash('alert', sprintf("%s (Line %d): %s", $e->getFile(), $e->getLine(), $e->getMessage()));
     } else {
         if (strlen($e->getMessage()) > 1) {
             \Session::flash('alert', $e->getMessage());
         }
     }
     if ($e instanceof ModelNotFoundException) {
         $e = new NotFoundHttpException($e->getMessage(), $e);
     }
     if (config('app.debug') && app()->environment() != 'testing') {
         return $this->renderExceptionWithWhoops($request, $e);
     }
     return parent::render($request, $e);
 }
Ejemplo n.º 2
0
 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Exception $exception
  * @return \Illuminate\Http\Response
  * @throws \InvalidArgumentException
  */
 public function render($request, Exception $exception)
 {
     Bugsnag::notifyException($exception);
     if (config('app.debug')) {
         $this->renderExceptionWithWhoops($request, $exception);
     }
     return parent::render($request, $exception);
 }