/** * Get the error response associated with the given exception. * * @param \Exception $exception * @param string $id * @param int $code * @param string[] $headers * * @return \Symfony\Component\HttpFoundation\Response */ public function display(Exception $exception, $id, $code, array $headers) { $info = $this->info->generate($exception, $id, $code); return new Response($this->render($info), $code, array_merge($headers, ['Content-Type' => $this->contentType()])); }
/** * Get the error response associated with the given exception. * * @param \Exception $exception * @param string $id * @param int $code * @param string[] $headers * * @return \Symfony\Component\HttpFoundation\Response */ public function display(Exception $exception, $id, $code, array $headers) { $info = $this->info->generate($exception, $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()])); }