Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#17211 closed defect (wontfix)

Promise.always doesn't propagate errors

Reported by: jandockx Owned by: Mark Wubben
Priority: undecided Milestone: tbd
Component: Core Version: 1.9.0
Keywords: Cc:
Blocked By: Blocking:


Promise always doesn't propagate errors.

The current implementation is

always: function(callbackOrErrback){
			// summary:
			//		Add a callback to be invoked when the promise is resolved
			//		or rejected.
			// callbackOrErrback: Function?
			//		A function that is used both as a callback and errback.
			// returns: dojo/promise/Promise
			//		Returns a new promise for the result of the callback/errback.

			return this.then(callbackOrErrback, callbackOrErrback);

It should be

 return this.then(
    function(err) {;
        throw err;

Change History (4)

comment:1 Changed 9 years ago by ben hockey

Component: GeneralCore
Owner: set to Mark Wubben
Status: newassigned

i'm fairly sure our implementation is intentionally like this. i'll leave it to mark to give further feedback or close the ticket.

comment:2 Changed 9 years ago by Mark Wubben

Resolution: wontfix
Status: assignedclosed

Yes this is as intended. You shouldn't handle rejections separately from fulfillment in these callbacks, if you need that use then().

comment:3 Changed 9 years ago by bill

Summary: Promise.always is wrongPromise.always doesn't propagate errors

Give ticket hopefully meaningful summary.

comment:4 Changed 9 years ago by jandockx

got it; I though it was intended as a "finally"; maybe that could be a separate (new) function

Note: See TracTickets for help on using tickets.