Skip to content
Permalink
Browse files

Catch one more place where a plain-text error was thrown.

  • Loading branch information...
dmethvin committed Nov 8, 2011
1 parent f0e43fa commit cc4a999648d2623972e6dabad0e6c4b1bb60458a
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/ajax.js
@@ -546,7 +546,7 @@ jQuery.extend({
} catch(e) {
// We have a parsererror
statusText = "parsererror";
error = e;
error = e.message;
}
}
} else {

3 comments on commit cc4a999

@jaubourg

This comment has been minimized.

Copy link
Member

jaubourg replied Nov 8, 2011

Hmmm... you probably shouldn't here. We're supposed to give the exception object to the error callbacks. What are we trying to handle here exactly ?

@dmethvin

This comment has been minimized.

Copy link
Member Author

dmethvin replied Nov 8, 2011

Oh good, daddy is here! :)

IE won't give the user any useful error information if a plain string is thrown, so we changed jQuery.error to throw new Error(msg) instead. Since ajax uses it to throw in the transports I needed to find the places it was expecting strings. Thoughts?

@jaubourg

This comment has been minimized.

Copy link
Member

jaubourg replied Nov 8, 2011

Well, it's not actually expecting a string here, because it's catching around the use of converters (where native exceptions can be thrown depending on how such or such converter is implemented). The third parameter of the error callbacks (which is the sole use of the error variable here) is supposed to be the original exception whenever available. In fact same goes for transports actually.

Please sign in to comment.
You can’t perform that action at this time.