/** * Render the given HttpException. * * @param \Symfony\Component\HttpKernel\Exception\HttpException $e * * @return \Symfony\Component\HttpFoundation\Response */ protected function renderHttpException(HttpException $e) { $status = $e->getStatusCode(); if (view()->exists("soda-example::errors.{$status}")) { return response()->view("soda-example::errors.{$status}", ['exception' => $e], $status, $e->getHeaders()); } else { return response()->view("soda-example::errors.other", ['exception' => $e], $status, $e->getHeaders()); } }
function it_prepares_http_exceptions(HttpException $httpException) { $httpException->getStatusCode()->willReturn(404); $httpException->getHeaders()->willReturn(['Header:test']); $this->handleException($httpException); $this->sendHttpCode()->shouldReturn(404); $this->headers()->shouldReturn(['Header:test']); }
/** * Функция для отображения сообщений на страницах ошибок (404, 500 etc.) * @param HttpException $e * @return \Illuminate\Http\Response */ protected function renderHttpException(HttpException $e) { $status = $e->getStatusCode(); if (view()->exists("errors.{$status}")) { return response()->view("errors.{$status}", ['message' => $e->getMessage(), 'status' => $status, 'headers' => $e->getHeaders()], $status); } else { return $status; } }
protected function renderHttpException(HttpException $e) { $status = $e->getStatusCode(); if (view()->exists($this->pathErrors . $status)) { return response()->view($this->pathErrors . $status, ['exception' => $e], $status, $e->getHeaders()); } else { return parent::renderHttpException($e); } }
/** * Render the given HttpException. * * @param \Symfony\Component\HttpKernel\Exception\HttpException $e * @return \Symfony\Component\HttpFoundation\Response */ protected function renderHttpException(HttpException $e) { $status = $e->getStatusCode(); if (view()->exists("errors.{$status}")) { return response()->view("errors.{$status}", ['exception' => $e], $status, $e->getHeaders()); } else { return $this->convertExceptionToResponse($e); } }
/** * @param \Symfony\Component\HttpKernel\Exception\HttpException $exception * * @return \Symfony\Component\HttpFoundation\Response */ protected function renderHttpException(HttpException $exception) { $status = $exception->getStatusCode(); if ($this->view->exists("error::{$status}") && !$this->configuration->get('app.debug')) { return $this->response->view("error::{$status}", ['exception' => $exception], $status, $exception->getHeaders()); } else { return $this->convertExceptionToResponse($exception); } }
/** * Render the given HttpException. * * @param \Symfony\Component\HttpKernel\Exception\HttpException $e * @return \Symfony\Component\HttpFoundation\Response */ protected function renderHttpException(HttpException $e) { $status = $e->getStatusCode(); $hoje = getdate(); $hoje2 = $hoje['year'] . '-' . $hoje['mon'] . '-' . $hoje['mday']; $mensagem = MensagemAdm::all()->last(); $acaos = DB::table('acaos')->select('*')->where('data_sorteio', '>=', $hoje2)->where('deleted_at', null)->where('winner_id', null)->get(); $criador = DB::table('users')->select('*')->join('acaos', 'users.id', '=', 'acaos.user_id')->get(); $rifas = DB::table('rifas')->select('*')->join('users', 'rifas.user_id', '=', 'users.id')->whereNotNull('user_id')->groupby('name', 'acao_id')->get(); if (view()->exists("errors.{$status}")) { return response()->view("errors.{$status}", ['exception' => $e, 'mensagem' => $mensagem, 'acaos' => $acaos, 'criador' => $criador, 'rifas' => $rifas], $status, $e->getHeaders()); } else { return $this->convertExceptionToResponse($e); } }
private function handleHttpException(HttpException $e, $code) { $message = array('status' => $e->getStatusCode(), 'code' => $code, 'message' => $e->getMessage()); return $this->app->json($message, $e->getStatusCode(), $e->getHeaders()); }
function it_uses_the_headers_from_an_HttpExceptionInterface(HttpException $exception) { $exception->getStatusCode()->willReturn(401); $exception->getHeaders()->willReturn(array('Foo' => 'Bar')); $this->display($exception)->headers->get('Foo')->shouldBe('Bar'); }
/** * Create a http response. * * @param HttpException $exception The exception to create a response for. * * @return JsonResponse */ private function createHttpExceptionResponse(HttpException $exception) { return new JsonResponse(['status' => 'ERROR', 'message' => $exception->getMessage()], $exception->getStatusCode(), $exception->getHeaders()); }
/** * @dataProvider headerDataProvider */ public function testHeadersConstructor($headers) { $exception = new HttpException(200, null, null, $headers); $this->assertSame($headers, $exception->getHeaders()); }