diff --git a/core/misc/drupal.js b/core/misc/drupal.js
index 458d385..d8e4c39 100644
--- a/core/misc/drupal.js
+++ b/core/misc/drupal.js
@@ -18,28 +18,6 @@ if (window.jQuery) {
   "use strict";
 
   /**
-   * Custom error type thrown after attach/detach if one or more behaviors failed.
-   *
-   * @param list
-   *   An array of errors thrown during attach/detach.
-   * @param event
-   *   A string containing either 'attach' or 'detach'.
-   */
-  function DrupalBehaviorError(list, event) {
-    this.name = 'DrupalBehaviorError';
-    this.event = event || 'attach';
-    this.list = list;
-    // Makes the list of errors readable.
-    var messageList = [];
-    messageList.push(this.event);
-    for (var i = 0, il = this.list.length; i < il; i++) {
-      messageList.push(this.list[i].behavior + ': ' + this.list[i].error.message);
-    }
-    this.message = messageList.join(' ; ');
-  }
-  DrupalBehaviorError.prototype = new Error();
-
-  /**
    * Attach all registered behaviors to a page element.
    *
    * Behaviors are event-triggered actions that attach to page elements, enhancing
@@ -80,22 +58,26 @@ if (window.jQuery) {
   Drupal.attachBehaviors = function (context, settings) {
     context = context || document;
     settings = settings || drupalSettings;
-    var i, errors = [], behaviors = Drupal.behaviors;
-    // Execute all of them.
-    for (i in behaviors) {
-      if (behaviors.hasOwnProperty(i) && typeof behaviors[i].attach === 'function') {
+    var errors = [];
+    var behaviors = Drupal.behaviors;
+
+    function runBehavior(name) {
+      if (typeof behaviors[name].attach === 'function') {
         // Don't stop the execution of behaviors in case of an error.
         try {
-          behaviors[i].attach(context, settings);
+          behaviors[name].attach(context, settings);
         }
         catch (e) {
-          errors.push({ behavior: i, error: e });
+          errors.push(e);
         }
       }
     }
+
+    // Execute all of them.
+    Object.keys(behaviors).forEach(runBehavior);
     // Once all behaviors have been processed, inform the user about errors.
     if (errors.length) {
-      throw new DrupalBehaviorError(errors, 'attach');
+      errors.forEach(Drupal.throwError);
     }
   };
 
@@ -146,26 +128,39 @@ if (window.jQuery) {
     context = context || document;
     settings = settings || drupalSettings;
     trigger = trigger || 'unload';
-    var i, errors = [], behaviors = Drupal.behaviors;
-    // Execute all of them.
-    for (i in behaviors) {
-      if (behaviors.hasOwnProperty(i) && typeof behaviors[i].detach === 'function') {
+    var errors = [];
+    var behaviors = Drupal.behaviors;
+
+    function runBehavior(name) {
+      if (typeof behaviors[name].detach === 'function') {
         // Don't stop the execution of behaviors in case of an error.
         try {
-          behaviors[i].detach(context, settings, trigger);
+          behaviors[name].detach(context, settings, trigger);
         }
         catch (e) {
-          errors.push({ behavior: i, error: e });
+          errors.push(e);
         }
       }
     }
+
+    // Execute all of them.
+    Object.keys(behaviors).forEach(runBehavior);
     // Once all behaviors have been processed, inform the user about errors.
     if (errors.length) {
-      throw new DrupalBehaviorError(errors, 'detach:' + trigger);
+      errors.forEach(Drupal.throwError);
     }
   };
 
   /**
+   * Helper to rethrow errors asynchronously. This way Exceptions bubbles up
+   * outside of the original callstack, making easier to debug errors in the
+   * browser.
+   */
+  Drupal.throwError = function (error) {
+    setTimeout(function () { throw error; }, 0);
+  };
+
+  /**
    * Helper to test document width for mobile configurations.
    * @todo Temporary solution for the mobile initiative.
    */
