Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#10906 closed bug (wontfix)

ajaxStop event not fired when one of the ajax success throw exception

Reported by: jackysee@… Owned by: jackysee@…
Priority: low Milestone: None
Component: ajax Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

Example here:

http://jsfiddle.net/wVjZy/

The problem is that there is no error shown in console. The return callback seems to be try-catch-ed, making it difficult to debug.

Change History (6)

comment:1 Changed 8 years ago by sindresorhus

Owner: set to jackysee@…
Status: newpending

What browser and version are you using?

I tried the fiddle on Chrome 15 and Firefox 8, and correctly got the error in console: uncaught exception: Error in success function

comment:2 Changed 8 years ago by jackysee@…

Status: pendingnew

I tried it on Firefox (Aurora) 10

comment:3 Changed 8 years ago by sindresorhus

Status: newpending

jQuery does not support dev browser versions, since they might during development. Can you reproduce it on any stable browser?

comment:4 Changed 8 years ago by jackysee@…

Status: pendingnew

Cannot reproduce the bug in other stable browser.

comment:5 Changed 8 years ago by sindresorhus

Component: unfiledajax
Priority: undecidedlow
Resolution: wontfix
Status: newclosed

Closing this as a wontfix. Can be opened if this still occurs when the stable version is released.

comment:6 Changed 7 years ago by erikjan.vos@…

I was surprised this was the only page I could find on this issue. Generally that means I'm doing something wrong :-)

But running this slightly improved fiddle:

http://jsfiddle.net/wVjZy/2/

causes both stable IE9 and FF18 to not trigger the ajaxStop event.

Shouldn't the Ajax event handlers act "decoupled" and be executed in a try...catch...finally block, like this?

try {
    successCallback();
}
// IE8 needs an explicit catch block
catch (e) {
    throw e;
}
finally {
    triggerAjaxComplete();
}

Or is throwing an exception and re-throwing to some exception handler lower in the stack not how things are done in the Javascript world?

Note: See TracTickets for help on using tickets.