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

fix($resource): fulfill promise with the correct value on error #14839

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Jun 28, 2016

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix.

What is the current behavior? (You can also link to an open issue here)
See #14837.

What is the new behavior (if this is a feature change)?
Restores the 1.5.x behavior.

Does this PR introduce a breaking change?
No, since it fixes (yet unreleased) regression.

Please check if the PR fulfills these requirements

Other information:
Fixes #14837

The first commit (which only contains a couple of tests) could be backported to 1.5.x, in order to verify that the behavior is correct on that branch.

gkalpak added 2 commits June 28, 2016 23:29
The test currently fail on master, but should pass on 1.5.x.
A subsequent commit will fix the regressions on master.

(This commit should be backportable to 1.5.x.)

Related to angular#14837.
This fixes a regression introduced with 71cf28c. See angular#14837 for more info.

Fixes angular#14837
@@ -776,13 +778,18 @@ angular.module('ngResource', ['ng']).
(success || noop)(value, response.headers);
return value;
},
responseErrorInterceptor || error ?
(hasError || hasResponseErrorInterceptor) ?
Copy link
Contributor

@Narretz Narretz Jun 30, 2016

Choose a reason for hiding this comment

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

Can we use a real if here? The whole block is pretty hard to read (for me)

No, we can't, because it's the error fn of the promise

@gkalpak gkalpak deleted the fix-resource-with-responseErrorInterceptor branch July 18, 2016 15:04
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.

bug($resource): promise not resolved with value returned by responseErrorInterceptor
4 participants