reverted: --- b/core/includes/errors.inc +++ a/core/includes/errors.inc @@ -81,10 +81,10 @@ * Decodes an exception and retrieves the correct caller. * + * @param $exception - * @param exception $exception * The exception object that was thrown. * + * @return - * @return array * An error in the format expected by _drupal_log_error(). */ // Add the line throwing the exception to the backtrace. array_unshift($backtrace, array('line' => $exception->getLine(), 'file' => $exception->getFile())); reverted: --- b/core/lib/Drupal/Core/Extension/ModuleHandler.php +++ a/core/lib/Drupal/Core/Extension/ModuleHandler.php @@ -646,18 +646,8 @@ // Record the fact that it was installed. $modules_installed[] = $module; + // Allow the module to perform install tasks. + $this->invoke($module, 'install'); - try { - // Allow the module to perform install tasks. - $this->invoke($module, 'install'); - } - catch (\Exception $e) { - // In the rare case there is an exception, log this to watchdog - // instead of just dumping the error... - watchdog_exception('system', $e, 'Exception thrown by %module during hook_install', array('%module' => $module), WATCHDOG_ERROR); - // ...and then throw it again so that the user knows and the - // exception is not compounded with other modules installing. - throw $e; - } // Record the fact that it was installed. watchdog('system', '%module module installed.', array('%module' => $module), WATCHDOG_INFO); } only in patch2: unchanged: --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -285,8 +285,17 @@ public function install(array $module_list, $enable_dependencies = TRUE) { // @see https://drupal.org/node/2208429 \Drupal::service('theme_handler')->refreshInfo(); - // Allow the module to perform install tasks. - $this->moduleHandler->invoke($module, 'install'); + try { + // Allow the module to perform install tasks. + $this->moduleHandler->invoke($module, 'install'); + } catch (\Exception $e) { + // In the rare case there is an exception, log this to watchdog + // instead of just dumping the error... + watchdog_exception('system', $e, 'Exception thrown by %module during hook_install', array('%module' => $module), E_ERROR); + // ...and then throw it again so that the user knows and the + // exception is not compounded with other modules installing. + throw $e; + } // Record the fact that it was installed. \Drupal::logger('system')->info('%module module installed.', array('%module' => $module)); only in patch2: unchanged: --- a/core/lib/Drupal/Core/Utility/Error.php +++ b/core/lib/Drupal/Core/Utility/Error.php @@ -47,6 +47,18 @@ public static function decodeException(\Exception $exception) { // Add the line throwing the exception to the backtrace. array_unshift($backtrace, array('line' => $exception->getLine(), 'file' => $exception->getFile())); + // If there are closures in the exception, modify the backtrace. + foreach ($backtrace as &$trace) { + if (isset($trace['args'])) { + foreach ($trace['args'] as $k => $arg) { + if ($arg instanceof \Closure) { + // Remove the closure to prevent problems later. + unset($trace['args'][$k]); + } + } + } + } + // For PDOException errors, we try to return the initial caller, // skipping internal functions of the database layer. if ($exception instanceof \PDOException || $exception instanceof DatabaseExceptionWrapper) {