diff --git a/core/lib/Drupal/Core/Routing/MatcherDumper.php b/core/lib/Drupal/Core/Routing/MatcherDumper.php index 8c91aa2..4ab4c18 100644 --- a/core/lib/Drupal/Core/Routing/MatcherDumper.php +++ b/core/lib/Drupal/Core/Routing/MatcherDumper.php @@ -118,19 +118,21 @@ public function dump(array $options = array()) { // Delete any old records in this route set first, then insert the new ones. // That avoids stale data. The transaction makes it atomic to avoid // unstable router states due to random failures. - $txn = $this->connection->startTransaction(); - - $this->connection->delete($this->tableName) - ->condition('route_set', $options['route_set']) - ->execute(); - - $insert->execute(); - - // We want to reuse the dumper for multiple route sets, so on dump, flush - // the queued routes. - $this->routes = NULL; - - // Transaction ends here. + + try { + $this->connection->delete($this->tableName) + ->condition('route_set', $options['route_set']) + ->execute(); + $insert->execute(); + // We want to reuse the dumper for multiple route sets, so on dump, flush + // the queued routes. + $this->routes = NULL; + } catch (\Exception $e) { + $txn = $this->connection->startTransaction(); + $txn->rollback(); + watchdog_exception('Routing', $e); + throw $e; + } } /**