Esempio 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 ($handler = $this->getHandler($e)) {
         return call_user_func($handler, $e, $this);
     }
     return parent::render($request, $e);
 }
Esempio n. 2
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 TokenMismatchException) {
         return back()->with('csrf_error', trans('admin.csrf_error'));
     }
     return parent::render($request, $e);
 }
Esempio n. 3
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 ModelNotFoundException) {
         $e = new NotFoundHttpException($e->getMessage(), $e);
     }
     return parent::render($request, $e);
 }
Esempio n. 4
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 ModelNotFoundException) {
         $e = new HttpNotFoundException('Resource not found');
     }
     return parent::render($request, $e);
 }
Esempio n. 5
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 ($this->isHttpException($e)) {
         return $this->renderHttpException($e);
     } else {
         return parent::render($request, $e);
     }
 }
Esempio n. 6
0
File: Handler.php Progetto: garf/0ez
 /**
  * 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 ($this->isResponseException($e)) {
         return parent::render($request, $e);
     }
     if ($this->isNotFountException($e)) {
         if ($request->ajax() || $request->wantsJson()) {
             return new JsonResponse(['404: ' . $e->getMessage()], 404);
         }
         return response()->view('errors.404', ['exception' => $e], 404);
     }
     if (config('app.debug')) {
         return $this->handleInDebugMode($request, $e);
     }
     return $this->handleInProductionMode($request, $e);
 }
Esempio n. 7
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 ModelNotFoundException) {
         $e = new NotFoundHttpException($e->getMessage(), $e);
     }
     if ($e instanceof TokenMismatchException) {
         return redirect($request->fullurl())->with('csrf_error', 'Taking too Long, please refresh the page and try again');
     }
     if ($e instanceof MethodNotAllowedHttpException) {
         return redirect($request->fullurl())->with('csrf_error', 'Taking too Long, please refresh the page and try again');
     }
     // if($e instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException)
     // {
     //      return redirect()->action('loginController@logout');
     // }
     return parent::render($request, $e);
 }
Esempio n. 8
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)
 {
     return parent::render($request, $e);
 }