diff --git a/core/misc/ajax.js b/core/misc/ajax.js
index 8e935ed..5bc7a70 100644
--- a/core/misc/ajax.js
+++ b/core/misc/ajax.js
@@ -448,7 +448,6 @@ Drupal.ajax.prototype.getEffect = function (response) {
  * Handler for the form redirection error.
  */
 Drupal.ajax.prototype.error = function (response, uri) {
-  window.alert(Drupal.ajaxError(response, uri));
   // Remove the progress element.
   if (this.progress.element) {
     $(this.progress.element).remove();
@@ -465,6 +464,7 @@ Drupal.ajax.prototype.error = function (response, uri) {
     var settings = response.settings || this.settings || Drupal.settings;
     Drupal.attachBehaviors(this.form, settings);
   }
+  throw new Drupal.AjaxError(response, uri);
 };
 
 /**
diff --git a/core/misc/autocomplete.js b/core/misc/autocomplete.js
index dc58b19..8610984 100644
--- a/core/misc/autocomplete.js
+++ b/core/misc/autocomplete.js
@@ -314,7 +314,7 @@ Drupal.ACDB.prototype.search = function (searchString) {
         }
       },
       error: function (xmlhttp) {
-        alert(Drupal.ajaxError(xmlhttp, db.uri));
+        throw new Drupal.AjaxError(xmlhttp, db.uri);
       }
     });
   }, this.delay);
diff --git a/core/misc/drupal.js b/core/misc/drupal.js
index 627e264..a7d3d0d 100644
--- a/core/misc/drupal.js
+++ b/core/misc/drupal.js
@@ -393,9 +393,10 @@ Drupal.getSelection = function (element) {
 };
 
 /**
- * Build an error message from an Ajax response.
+ * Extends Error to provide handling for Errors in AJAX
  */
-Drupal.ajaxError = function (xmlhttp, uri) {
+Drupal.AjaxError = function(xmlhttp, uri) {
+
   var statusCode, statusText, pathText, responseText, readyStateText, message;
   if (xmlhttp.status) {
     statusCode = "\n" + Drupal.t("An AJAX HTTP error occurred.") +  "\n" + Drupal.t("HTTP Result Code: !status", {'!status': xmlhttp.status});
@@ -429,9 +430,14 @@ Drupal.ajaxError = function (xmlhttp, uri) {
   readyStateText = xmlhttp.status === 0 ? ("\n" + Drupal.t("ReadyState: !readyState", {'!readyState': xmlhttp.readyState})) : "";
 
   message = statusCode + pathText + statusText + responseText + readyStateText;
-  return message;
+
+  this.name = message;
+  Error.call(this, message);
 };
 
+Drupal.AjaxError.prototype = new Error();
+Drupal.AjaxError.prototype.constructor = Drupal.AjaxError;
+
 // Class indicating that JS is enabled; used for styling purpose.
 $('html').addClass('js');
 
diff --git a/core/misc/progress.js b/core/misc/progress.js
index 5959f6d..e4c5110 100644
--- a/core/misc/progress.js
+++ b/core/misc/progress.js
@@ -88,7 +88,7 @@ $.extend(Drupal.ProgressBar.prototype, {
           pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay);
         },
         error: function (xmlhttp) {
-          pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri));
+          throw new Drupal.AjaxError(xmlhttp, pb.uri);
         }
       });
     }
