diff --git a/core/authorize.php b/core/authorize.php index d5baed4..9ec9308 100644 --- a/core/authorize.php +++ b/core/authorize.php @@ -25,6 +25,7 @@ use Drupal\Core\Url; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Drupal\Core\Site\Settings; // Change the directory to the Drupal root. diff --git a/core/includes/errors.inc b/core/includes/errors.inc index 8caf68f..e64ab1b 100644 --- a/core/includes/errors.inc +++ b/core/includes/errors.inc @@ -8,8 +8,8 @@ use Drupal\Component\Utility\SafeMarkup; use Drupal\Component\Utility\Xss; use Drupal\Core\Logger\RfcLogLevel; +use Drupal\Core\Render\CacheableHtmlResponse; use Drupal\Core\Utility\Error; -use Symfony\Component\HttpFoundation\Response; /** * Maps PHP error constants to watchdog severity levels. @@ -245,7 +245,7 @@ function _drupal_log_error($error, $fatal = FALSE) { } $bare_html_page_renderer = \Drupal::service('bare_html_page_renderer'); - $output = $bare_html_page_renderer->renderBarePage(['#markup' => $message], 'Error', 'maintenance_page', TRUE); + $output = $bare_html_page_renderer->renderBarePage(['#markup' => $message], 'Error', 'maintenance_page'); $response = new CacheableHtmlResponse($output, 500); diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index aede8b9..0f905c2 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -25,6 +25,7 @@ use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Route; use Drupal\user\Entity\User; use GuzzleHttp\Exception\RequestException; diff --git a/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionSubscriber.php index 17a7315..7820ca7 100644 --- a/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionSubscriber.php @@ -16,6 +16,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\KernelEvents; diff --git a/core/modules/system/src/Controller/DbUpdateController.php b/core/modules/system/src/Controller/DbUpdateController.php index 926da6b..4ac9799 100644 --- a/core/modules/system/src/Controller/DbUpdateController.php +++ b/core/modules/system/src/Controller/DbUpdateController.php @@ -20,6 +20,7 @@ use Drupal\Core\State\StateInterface; use Drupal\Core\Url; use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Request; /** diff --git a/core/themes/engines/twig/twig.engine b/core/themes/engines/twig/twig.engine index 9f8bc4a..38f3d5f 100644 --- a/core/themes/engines/twig/twig.engine +++ b/core/themes/engines/twig/twig.engine @@ -62,6 +62,17 @@ function twig_render_template($template_file, array $variables) { catch (\Twig_Error_Loader $e) { drupal_set_message($e->getMessage(), 'error'); } + catch (\Twig_Error_Runtime $e) { + // In case there is a previous exception, we just display the message and + // show the original Exception so that the original function that fails is + // shown. + $previous_exception = $e->getPrevious(); + if ($previous_exception) { + drupal_set_message($e->getMessage(), 'error'); + throw $previous_exception; + } + throw $e; + } if ($twig_service->isDebug()) { $output['debug_prefix'] .= "\n\n"; $output['debug_prefix'] .= "\n";