handle($request) // Handle the response object. ->prepare($request)->send(); $kernel->terminate($request, $response); } catch (HttpExceptionInterface $e) { $response = new Response($e->getMessage(), $e->getStatusCode()); $response->prepare($request)->send(); } catch (Exception $e) { $message = 'If you have just changed code (for example deployed a new module or moved an existing one) read http://drupal.org/documentation/rebuild'; if (Settings::get('rebuild_access', FALSE)) { $rebuild_path = $GLOBALS['base_url'] . '/rebuild.php'; $message .= " or run the rebuild script"; } // Set the response code manually. Otherwise, this response will default to a // 200. http_response_code(500); print $message; throw $e; }