reverted: --- b/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php +++ a/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php @@ -143,12 +143,7 @@ $connection_options['pdo'] += [\PDO::MYSQL_ATTR_MULTI_STATEMENTS => FALSE]; } + $pdo = new \PDO($dsn, $connection_options['username'], $connection_options['password'], $connection_options['pdo']); - try { - $pdo = new \PDO($dsn, $connection_options['username'], $connection_options['password'], $connection_options['pdo']); - } - catch (\PDOException $e) { - throw new DatabaseExceptionWrapper($e); - } // Force MySQL to use the UTF-8 character set. Also set the collation, if a // certain one has been set; otherwise, MySQL defaults to only in patch2: unchanged: --- a/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php +++ b/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php @@ -80,7 +80,15 @@ protected function createService(array $definition, $id) { throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory', $id)); } - $service = call_user_func_array($factory, $arguments); + // call_user_func_array() makes it appear that exceptions that occur in + // the called functions have occurred where call_user_func_array() was + // called. Instead, rethrow an exception to get a better call stack. + try { + $service = call_user_func_array($factory, $arguments); + } + catch (\Exception $e) { + throw new \Exception($e); + } } else { $class = $this->frozen ? $definition['class'] : current($this->resolveServicesAndParameters(array($definition['class'])));