Bug Tracker

Opened 5 years ago

Closed 4 years ago

#11292 closed bug (notabug)

Error During Done Function on a Promise Is Skipped on Subsequent Runs

Reported by: jrduncans Owned by:
Priority: low Milestone: 1.next
Component: deferred Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:


Having an error in a .done() callback function seems to permanently break the state of a Deferred, in a way that success does not. The documentation of Deferred does not cover error handling within callbacks, so it's not clear if this is by design or not.

Demo: http://jsfiddle.net/2JFnM/

Change History (6)

comment:1 Changed 5 years ago by sindresorhus

  • Component changed from unfiled to deferred
  • Keywords needsdocs added
  • Priority changed from undecided to low
  • Status changed from new to open

I think the consensus is that you should handle your own exceptions. jQuery should not hide it away.

See the duplicates for more info and discussion.

Duplicates: #11207, #11193, #9033

Leaving it open so that it can be documented.

comment:2 Changed 5 years ago by dmethvin

  • Milestone changed from None to 1.8

Dean Edwards documented a way of using synthetic events as callbacks to prevent this problem, but I don't know if it can be applied. The use of a propertychange handler on documentElement seems like it might pose some performance problems.


Let's explore for 1.8 and decide whether it can be fixed or if we should just document current behavior.

comment:3 Changed 5 years ago by jaubourg

Eveything is said here: http://bugs.jquery.com/ticket/11193#comment:3

In an ideal world, we'd be able to use try/finally but, because of IE, we can't.

comment:4 Changed 5 years ago by dmethvin

  • Milestone changed from 1.8 to 1.next

This can be fixed eventually, but not until oldIE bites the dust.

comment:5 Changed 4 years ago by mikesherov

  • Keywords needsdocs removed

comment:6 Changed 4 years ago by mikesherov

  • Resolution set to notabug
  • Status changed from open to closed
Note: See TracTickets for help on using tickets.