classes/Errors/ErrorHandlerManager.php
protected function makeResponse($response, Exception $exception)
	{
		if (!$response instanceof Response) {
			$response = new Response($response);
		}

		if (!$response->isClientError() && !$response->isServerError() && !$response->isRedirect()) {
			if ($exception instanceof HttpExceptionInterface) {
				$response->setStatusCode($exception->getStatusCode());
				$response->headers->add($exception->getHeaders());
			} else {
				$response->setStatusCode(500);
			}
		}

		return $response;
	}
protected function makeResponse($response, Exception $exception)
	{
		if (!$response instanceof Response) {
			$response = new Response($response);
		}

		if (!$response->isClientError() && !$response->isServerError() && !$response->isRedirect()) {
			if ($exception instanceof HttpExceptionInterface) {
				$response->setStatusCode($exception->getStatusCode());
				$response->headers->add($exception->getHeaders());
			} else {
				$response->setStatusCode(500);
			}
		}

		return $response;
	}
Transform an exception handler's response into a Response object.

@param  mixed      $response
@param  \Exception $exception

@return \Symfony\Component\HttpFoundation\Response