Laravel\Lumen\Exceptions\Handler::render PHP Method

render() public method

Render an exception into an HTTP response.
public render ( Illuminate\Http\Request $request, Exception $e ) : Illuminate\Http\Response
$request Illuminate\Http\Request
$e Exception
return Illuminate\Http\Response
    public function render($request, Exception $e)
    {
        if ($e instanceof HttpResponseException) {
            return $e->getResponse();
        } elseif ($e instanceof ModelNotFoundException) {
            $e = new NotFoundHttpException($e->getMessage(), $e);
        } elseif ($e instanceof AuthorizationException) {
            $e = new HttpException(403, $e->getMessage());
        } elseif ($e instanceof ValidationException && $e->getResponse()) {
            return $e->getResponse();
        }
        $fe = FlattenException::create($e);
        $handler = new SymfonyExceptionHandler(env('APP_DEBUG', false));
        $decorated = $this->decorate($handler->getContent($fe), $handler->getStylesheet($fe));
        $response = new Response($decorated, $fe->getStatusCode(), $fe->getHeaders());
        $response->exception = $e;
        return $response;
    }

Usage Example

コード例 #1
2
ファイル: Handler.php プロジェクト: jrenton/volumio
 /**
  * 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 \Symfony\Component\HttpKernel\Exception\NotFoundHttpException) {
         return view('home');
     }
     return parent::render($request, $e);
 }
All Usage Examples Of Laravel\Lumen\Exceptions\Handler::render