Example #1
0
 /**
  * {@inheritdoc}
  */
 public function display(Throwable $exception, string $id, int $code, array $headers) : ResponseInterface
 {
     $info = $this->info->generate($id, $code);
     $error = ['id' => $id, 'status' => $info['code'], 'title' => $info['name'], 'detail' => $info['detail']];
     return new JsonResponse(['errors' => [$error]], $code, array_merge($headers, ['Content-Type' => $this->contentType()]));
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function display(Throwable $exception, string $id, int $code, array $headers) : ResponseInterface
 {
     $info = $this->info->generate($id, $code);
     $view = $this->factory->create("errors.{$code}", $info);
     return new HtmlResponse((string) $view, $code, array_merge($headers, ['Content-Type' => $this->contentType()]));
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function display(Throwable $exception, string $id, int $code, array $headers) : ResponseInterface
 {
     $info = $this->info->generate($id, $code);
     return new HtmlResponse($this->render($info), $code, array_merge($headers, ['Content-Type' => $this->contentType()]));
 }