diff --git a/core/lib/Drupal/Core/EventSubscriber/SpecialAttributesRouteSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/SpecialAttributesRouteSubscriber.php
index 22e82d2..639af7e 100644
--- a/core/lib/Drupal/Core/EventSubscriber/SpecialAttributesRouteSubscriber.php
+++ b/core/lib/Drupal/Core/EventSubscriber/SpecialAttributesRouteSubscriber.php
@@ -41,12 +41,10 @@ public function onRouteBuilding(RouteBuildEvent $event) {
       '_form',
     );
 
-    foreach ($event->getRouteCollection()->all() as $route) {
+    foreach ($event->getRouteCollection() as $route_name => $route) {
       if ($not_allowed_variables = array_intersect($route->compile()->getVariables(), $special_variables)) {
-        $placeholders = array('@variables' => implode(', ', $not_allowed_variables));
-        drupal_set_message(String::format('The following variables are reserved names by drupal: @variables', $placeholders));
-        watchdog('error', 'The following variables are reserved names by drupal: @variables', $placeholders);
-        return FALSE;
+        $placeholders = array('@variables' => implode(', ', $not_allowed_variables), '@route_name' => $route_name);
+        throw new \InvalidArgumentException(String::format('The following variables are reserved names by drupal: @variables. Broken route: @route_name', $placeholders));
       }
     }
     return TRUE;
diff --git a/core/lib/Drupal/Core/Routing/RouteBuilder.php b/core/lib/Drupal/Core/Routing/RouteBuilder.php
index fd59967..8440a51 100644
--- a/core/lib/Drupal/Core/Routing/RouteBuilder.php
+++ b/core/lib/Drupal/Core/Routing/RouteBuilder.php
@@ -84,6 +84,7 @@ public function rebuild() {
 
     $yaml_discovery = new YamlDiscovery('routing', $this->moduleHandler->getModuleDirectories());
 
+    $exceptions = array();
     foreach ($yaml_discovery->findAll() as $module => $routes) {
       $collection = new RouteCollection();
 
@@ -98,19 +99,50 @@ public function rebuild() {
         $collection->add($name, $route);
       }
 
-      $this->dispatcher->dispatch(RoutingEvents::ALTER, new RouteBuildEvent($collection, $module));
-      $this->dumper->addRoutes($collection);
-      $this->dumper->dump(array('route_set' => $module));
+
+      // Try to catch potentially exceptions thrown by route subscriber.
+      $has_exception = FALSE;
+      try {
+        $this->dispatcher->dispatch(RoutingEvents::ALTER, new RouteBuildEvent($collection, $module));
+      }
+      catch (\Exception $e) {
+        $exceptions[] = $e;
+        $has_exception = TRUE;
+      }
+      if (!$has_exception) {
+        $this->dumper->addRoutes($collection);
+        $this->dumper->dump(array('route_set' => $module));
+      }
     }
 
     // Now allow modules to register additional, dynamic routes.
     $collection = new RouteCollection();
-    $this->dispatcher->dispatch(RoutingEvents::DYNAMIC, new RouteBuildEvent($collection, 'dynamic_routes'));
-    $this->dispatcher->dispatch(RoutingEvents::ALTER, new RouteBuildEvent($collection, 'dynamic_routes'));
-    $this->dumper->addRoutes($collection);
-    $this->dumper->dump(array('route_set' => 'dynamic_routes'));
+
+    // Try to catch potentially exceptions thrown by route subscriber.
+    $has_exception = FALSE;
+    try {
+      $this->dispatcher->dispatch(RoutingEvents::DYNAMIC, new RouteBuildEvent($collection, 'dynamic_routes'));
+      $this->dispatcher->dispatch(RoutingEvents::ALTER, new RouteBuildEvent($collection, 'dynamic_routes'));
+    }
+    catch (\Exception $e) {
+      $has_exception = TRUE;
+      $exceptions[] = $e;
+    }
+    if (!$has_exception) {
+      $this->dumper->addRoutes($collection);
+      $this->dumper->dump(array('route_set' => 'dynamic_routes'));
+    }
 
     $this->lock->release('router_rebuild');
+
+    // Throw a single exception containing all the failed routes.
+    if ($exceptions) {
+      $message = array();
+      foreach ($exceptions as $exception) {
+        $message[] = $exception->getMessage();
+      }
+      throw new \Exception(implode("\n", $message));
+    }
   }
 
 }
diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php
index 7555768..b14f39b 100644
--- a/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php
+++ b/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php
@@ -104,26 +104,17 @@ public function testOnRouteBuildingValidVariables(Route $route) {
    * @param \Symfony\Component\Routing\Route $route
    *   The route to check.
    *
+   * @expectedException \InvalidArgumentException
+   *
    * @dataProvider providerTestOnRouteBuildingInvalidVariables
    */
   public function testOnRouteBuildingInvalidVariables(Route $route) {
     $route_collection = new RouteCollection();
     $route_collection->add('test', $route);
     $event = new RouteBuildEvent($route_collection, 'test');
-    $this->assertFalse($this->specialAttributesRouteSubscriber->onRouteBuilding($event));
+    $this->specialAttributesRouteSubscriber->onRouteBuilding($event);
   }
 
 }
 
 }
-
-namespace {
-  if (!function_exists('watchdog')) {
-    function watchdog($type, $message, array $args = NULL) {
-    }
-  }
-  if (!function_exists('drupal_set_message')) {
-    function drupal_set_message($type = NULL, $message = '') {
-    }
-  }
-}
