// the developer asked for a specific status code
if(!$event->isAllowingCustomResponseCode() && !$response->isClientError() && !$response->isServerError() && !$response->isRedirect()){ // ensure that we actually have an error response
if($e instanceof HttpExceptionInterface){ // keep the HTTP status code and headers
$response->setStatusCode($e->getStatusCode()); $response->headers->add($e->getHeaders()); }else{ $response->setStatusCode(500); } }
// the developer asked for a specific status code
if(!$event->isAllowingCustomResponseCode() && !$response->isClientError() && !$response->isServerError() && !$response->isRedirect()){ // ensure that we actually have an error response
if($e instanceof HttpExceptionInterface){ // keep the HTTP status code and headers
$response->setStatusCode($e->getStatusCode()); $response->headers->add($e->getHeaders()); }else{ $response->setStatusCode(500); } }