Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

fix($q): make $q.reject support finally and catch #6076

Closed
wants to merge 1 commit into from

Conversation

lgalfaso
Copy link
Contributor

Add support for the functions finally and catch to the promise returned by $q.reject

Closes #6048

Add support for the functions `finally` and `catch` to the
promise returned by `$q.reject`

Closes angular#6048
return result.promise;
};

var _reject = function(reason) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The one thing I don't like about this, is the naming of this function... I think it's a bit confusing, and would be better renamed to something like rejectImpl or something. I'm not sure everyone else would share this same opinion, though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. we should call it something like createInternalRejectedPromise or something of that sort. we already have 3 other reject methods/fields in this file so 4th is making it even worse especially since it's an internal-only factory function.

@IgorMinar
Copy link
Contributor

otherwise LGTM!

thanks @lgalfaso !

@caitp
Copy link
Contributor

caitp commented Jan 31, 2014

@IgorMinar mind if I just amend this real quick with that change and merge it? Would be good to ship this ... haven't heard from anyone about problems with this, but I'll revert if needed. Merging

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

$q.reject() returns a promise with then() but no catch() and no finally()
3 participants