diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 4747440..4e2dfb3 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -604,6 +604,9 @@ protected function handleException(\Exception $e, $request, $type) {
       $response->headers->add($e->getHeaders());
       return $response;
     }
+    elseif ($e instanceof BrokenContainerException) {
+      // Add rebuild-message here.
+    }
     else {
       throw $e;
     }
@@ -756,7 +759,12 @@ protected function initializeContainer() {
       }
       // If the load succeeded or the class already existed, use it.
       if (class_exists($fully_qualified_class_name, FALSE)) {
-        $container = new $fully_qualified_class_name;
+        try {
+          $container = new $fully_qualified_class_name;
+        }
+        catch (\Exception $e) {
+          throw new BrokenContainerException($e);
+        }
       }
     }
 
