Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add catch block to try/finally in deferred. Fixes #9033. Test case ne…
…eded.
- Loading branch information
0a80be6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was removed on purpose. Adding a catch block makes it impossible to debug in any browser. If IE8- complains, so be it.
See 5d9db48 and http://bugs.jquery.com/ticket/8353
The problem only occurs when an exception is thrown and only in IE. Better have an issue in IE rather than in every other browser. Would be a good idea to revert this.
0a80be6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't see it was added in the past. So even with throwing the error, other browsers won't see it?
0a80be6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it works ok. http://jsfiddle.net/timmywil/zWrJJ/1/
0a80be6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, "it works". Even the try/finally construct will work flawlessly in anything but IE8- :P
Like I said, the issue is debugging: you loose context (original file and line of the exception) and everything seems to originate from the catch/throw block. It makes it a nightmare to debug and even confuses users who think the exception actually really occured within the deferred code itself.
0a80be6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yea, didn't think about line of exception. Tickets for this keep coming so I would love to have a solution by 1.6.2. Maybe we can do some brainstorming.
0a80be6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the solution has to be that if you expect your callback to throw exceptions then you try/catch it inside the callback. If the problem is due to programming errors then it's debugger time, or you can just leave the try/catch in for production. I know it's an unfortunate problem since IE6/7 are browsers most likely to fail. But like @jaubourg says if we add the catch we totally screw up debugging in every other browser and hide problems.
/me shakes fist at IE7