Centralize the logic for throwing exceptions. Fixes #5913.

This commit is contained in:
jeresig 2010-01-23 16:48:47 -05:00
parent 3e286440d5
commit a6ef036bb6
3 changed files with 7 additions and 3 deletions

View file

@ -578,7 +578,7 @@ jQuery.extend({
data = xml ? xhr.responseXML : xhr.responseText;
if ( xml && data.documentElement.nodeName === "parsererror" ) {
throw "parsererror";
jQuery.error( "parsererror" );
}
// Allow a pre-filtering function to sanitize the response
@ -606,7 +606,7 @@ jQuery.extend({
}
} else {
throw "Invalid JSON: " + data;
jQuery.error( "Invalid JSON: " + data );
}
// If the type is "script", eval it in global context