Commit a6ef036b authored by jeresig's avatar jeresig

Centralize the logic for throwing exceptions. Fixes #5913.

parent 3e286440
...@@ -578,7 +578,7 @@ jQuery.extend({ ...@@ -578,7 +578,7 @@ jQuery.extend({
data = xml ? xhr.responseXML : xhr.responseText; data = xml ? xhr.responseXML : xhr.responseText;
if ( xml && data.documentElement.nodeName === "parsererror" ) { if ( xml && data.documentElement.nodeName === "parsererror" ) {
throw "parsererror"; jQuery.error( "parsererror" );
} }
// Allow a pre-filtering function to sanitize the response // Allow a pre-filtering function to sanitize the response
...@@ -606,7 +606,7 @@ jQuery.extend({ ...@@ -606,7 +606,7 @@ jQuery.extend({
} }
} else { } else {
throw "Invalid JSON: " + data; jQuery.error( "Invalid JSON: " + data );
} }
// If the type is "script", eval it in global context // If the type is "script", eval it in global context
......
...@@ -281,7 +281,7 @@ jQuery.extend({ ...@@ -281,7 +281,7 @@ jQuery.extend({
if ( set ) { if ( set ) {
// We can't allow the type property to be changed (since it causes problems in IE) // We can't allow the type property to be changed (since it causes problems in IE)
if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) { if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
throw "type property can't be changed"; jQuery.error( "type property can't be changed" );
} }
elem[ name ] = value; elem[ name ] = value;
......
...@@ -467,6 +467,10 @@ jQuery.extend({ ...@@ -467,6 +467,10 @@ jQuery.extend({
return true; return true;
}, },
error: function( msg ) {
throw msg;
},
noop: function() {}, noop: function() {},
// Evalulates a script in a global context // Evalulates a script in a global context
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment