Render the given HttpException.

@param  \Symfony\Component\HttpKernel\Exception\HttpException  $e
@return \Symfony\Component\HttpFoundation\Response
961209
protected function renderHttpException(HttpException $e)
    {
        $status = $e->getStatusCode();

        // Verificar se ha uma view implementado o erro
        if (function_exists('view')) {
            if (view()->exists("errors.{$status}")) {
                return response()->view("errors.{$status}", ['exception' => $e], $status, $e->getHeaders());
            }
        }

        return $this->convertExceptionToResponse($e);
    }
949703
public function render($request, Exception $e)
    {
        if ($e instanceof HttpResponseException) {
            return $e->getResponse();
        }

        if ($this->isHttpException($e)) {
            return $this->toIlluminateResponse($this->renderHttpException($e), $e);
        } else {
            return $this->toIlluminateResponse($this->convertExceptionToResponse($e), $e);
        }
    }
94296
public function render($request, Exception $e)
    {
        $errors = [
            'message' => $e->getMessage(),
            'trace' => collect($e->getTrace())->map(function ($item) {
                return [
                    'file' => array_get($item, 'file'),
                    'line' => array_get($item, 'line'),
                    'method' => array_get($item, 'function'),
                ];
            })->toArray(),
        ];
        $this->debug->setError($errors)->broadcast();

        return $this->exceptionHandler->render($request, $e);
    }
319733
protected function renderXmlHttpException($e)
    {
        // handle our ajax errors
        $data = [
            'message' => $e->getMessage(),
        ];

        if ($e instanceof HttpException) {
            return new JsonResponse($data, $e->getStatusCode());
        }

        return new JsonResponse($data, 500);
    }
737008
public static function run( \Exception $e )
	{
		$config = config('system.errors');
		if (($config['display'] || is_a( $e, Message::class )) && !($e instanceof QueryException)) {
			$obj = new Response( self::getErrorObject($e), ($e->getCode() ? $e->getCode() : 500) );
		} else {
			$obj = new Response( $e->getMessage(), 500 );
		}
		if ($config['log']) {
			self::logObject($e);
		}
		self::sendResponse( $obj );
	}
572493
protected function doException(\Exception $e)
    {
        $output = (new ResponseInjector)->build();

        $errorController = (new Injector)->param('errorController');
        $errorAction = (new Injector)->param('errorAction');

        if (!$errorController || !$errorAction) { // render SAPI error not configured
            $stream = $output->getBody();
            $stream->write('Option `errorController` or `errorAction` not configured');

            return $output->withBody($stream);
        }

        // Render SAPI error
        $body = (new RequestInjector)->build()->getParsedBody();
        $body['error'] = $e;

        $request = (new RequestInjector)->build()->withParsedBody($body);
        (new Injector)->addRequirement('request', $request);

        $controller = $errorController;

        /** @var \Micro\Mvc\Controllers\IController $result */
        $result = new $controller(false);
        $result = $result->action($errorAction);

        if ($result instanceof ResponseInterface) {
            return $result;
        }

        $stream = $output->getBody();
        $stream->write((string)$result);

        return $output->withBody($stream);
    }
1188984
protected function renderExceptionWithSymfony(Exception $e, $debug)
    {
        return (new SymfonyExceptionHandler($debug))->getHtml(
            FlattenException::create($e)
        );
    }
1174966
public function render($request, Exception $e)
    {
        if ($this->isHttpException($e))
        {
            if ($request->segment(1) == config('expendable.admin_base_uri') && !config('app.debug'))
            {
                return app('Distilleries\Expendable\Http\Controllers\Backend\Base\ErrorController')->callAction("display", [$e, $e->getStatusCode()]);
            }
        }

        return parent::render($request, $e);
    }
972104
public function render($request, Exception $exception)
    {
        $exception = $this->prepareException($exception);

        if ($exception instanceof HttpResponseException) {
            return $exception->getResponse();
        } elseif ($exception instanceof AuthenticationException) {
            return $this->unauthenticated($request, $exception);
        } elseif ($exception instanceof ValidationException) {
            return $this->convertValidationExceptionToResponse($exception, $request);
        } elseif ($this->isHttpException($exception) && $this->customErrorHtmlTemplateExists($exception)) {
            return $this->prepareResponse($request, $exception);
        }

        $flattened = FlattenException::create($exception);

        $code = $flattened->getStatusCode();
        $headers = $flattened->getHeaders();
        $response = $this->getContent($exception, $code, $request);

        // If it's already a response, return that.
        if (!$response instanceof BaseResponse) {
            $response = new Response($this->getContent($exception, $code, $request), $code, $headers);
        }

        return $response;
    }
304722
public function render(Exception $e, $debug)
    {
        $e = FlattenException::create($e);
        $handler = new SymfonyExceptionHandler($debug);
        $status = $e->getStatusCode();

        $response = SymfonyResponse::create($handler->getHtml($e), $status, $e->getHeaders());

        $rex = explode("\n", $response);

        if (strstr(strtolower($rex[0]), 'http')) {
            for ($i = 0; $i < 2; $i++) {
                array_shift($rex);
            }
        }

        if (View::exists("errors.{$status}")) {
            echo View::renderView("errors.{$status}", 'exception', implode("\n", $rex));
        } else {
            echo implode("\n", $rex);
        }
    }
652014
public function render($request, Exception $e)
    {
        // Verificar se deve responser como API
        if (app()->runningWebApi()) {
            return $this->renderApi($request, $e);
        }

        // Exceções Http
        if ($e instanceof HttpException) {
            if (! is_null($this->viewService)) {
                // Veriifcar se foi implemetado uma view no app
                $view = 'errors.' . $e->getStatusCode();
                if ($this->getViewService()->exists($view)) {
                    return $this->getViewService()->make($view)->render();
                }

                // Verificar se foi implememtado uma view no theme
                $view = 'theme::errors.' . $e->getStatusCode();
                if ($this->getViewService()->exists($view)) {
                    return $this->getViewService()->make($view)->render();
                }
            } else {
                $message = $e->getMessage();
                $message = ($message == '') ? $e->getStatusCode() : $message;
                return 'error: ' . $message;
            }
        }

        // ErrorsException
        if ($e instanceof ErrorsException) {
            $back = redirect()->back()->withInput()->withErrors($e->getErrors(), $e->getMessage());

            return $back;
        }


        return 'error: ' . $e->getMessage();
    }
18198
protected function handleHttpException(Exception $e)
    {
        $statusCode = $e->getStatusCode();

        // if there is no exception message just get the standard HTTP text.
        if (empty($e->getMessage())) {
            $message = Response::$statusTexts[$statusCode];
        } else {
            $message = $e->getMessage();
        }

        return $this->generateResponse('', null, $statusCode, Status::FAIL, $message);
    }
1317583
public function RenderError ($exceptionMessage = '') {
		if ($this->application->IsErrorDispatched()) return;
		throw new \ErrorException(
			$exceptionMessage ? $exceptionMessage :
			"Server error: `" . htmlspecialchars($this->request->GetFullUrl()) . "`.",
			500
		);
	}
427977
protected function createResponse($response, Exception $e)
    {
        $response = new HttpResponse($response->getContent(), $response->getStatusCode(), $response->headers->all());

        return $response->withException($e);
    }
336685
protected function renderHttpException(HttpExceptionInterface $e)
    {
        $status = $e->getStatusCode();

        if ($this->isCmsWebRequest() &&  view()->exists("cms::errors.{$status}")) {
            $flatException = FlattenException::create($e);

            return response()
                ->view(
                    "cms::errors.{$status}",
                    [ 'exception' => $flatException ],
                    $status,
                    $e->getHeaders()
                );
        }

        return parent::renderHttpException($e);
    }
197210
public function render($request, Exception $e)
	{
		if ($this->isHttpException($e))
		{
			return $this->renderHttpException($e);
		}
		else
		{
			return (new SymfonyDisplayer(config('app.debug')))->createResponse($e);
		}
	}
1303570
protected function handleException(Exception $e)
    {
        $handler = $this->app->make(ExceptionHandler::class);

        $handler->report($e);

        try {
            $handler->renderForConsole(
                $this->app->make(OutputInterface::class), $e
            );
        } catch (Throwable $e) {
            //
        }
    }