diff --git a/core/misc/ajax.js b/core/misc/ajax.js index 5001554..eb2c510 100644 --- a/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -234,7 +234,7 @@ */ Drupal.ajax = function (settings) { if (arguments.length !== 1) { - throw new Error('Drupal.ajax() function must be called with one configuration object only'); + Drupal.throwError(new Error('Drupal.ajax() function must be called with one configuration object only')); } // Map those config keys to variables for the old Drupal.ajax function. var base = settings.base || false; @@ -531,7 +531,7 @@ // Bind the ajaxSubmit function to the element event. $(ajax.element).on(element_settings.event, function (event) { if (!drupalSettings.ajaxTrustedUrl[ajax.url] && !Drupal.url.isLocal(ajax.url)) { - throw new Error(Drupal.t('The callback URL is not local and not trusted: !url', {'!url': ajax.url})); + Drupal.throwError(new Error(Drupal.t('The callback URL is not local and not trusted: !url', {'!url': ajax.url}))); } return ajax.eventResponse(this, event); }); @@ -962,7 +962,7 @@ var settings = this.settings || drupalSettings; Drupal.attachBehaviors(this.$form.get(0), settings); } - throw new Drupal.AjaxError(xmlhttprequest, uri, customMessage); + Drupal.throwError(new Drupal.AjaxError(xmlhttprequest, uri, customMessage)); }; /**