New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promises do not get rejected #13

Closed
XVincentX opened this Issue Jun 18, 2015 · 5 comments

Comments

Projects
None yet
2 participants
@XVincentX
Contributor

XVincentX commented Jun 18, 2015

Hey,
Looks like angular-hy-res is not rejecting promises when receiving some error from Http server. On the contrary, the promise gets resolved, but the argument of then function is undefined.

Am I missing something?

I am using the internal $promise as reference.

@petejohanson

This comment has been minimized.

Owner

petejohanson commented Jun 18, 2015

I think my error handler in the resource code that captures the rejection value and stores in a field may need to return a new rejection instead of no return at all. I think that is resulting in the undefined value.
Will research.
On Jun 18, 2015 1:11 PM, Vincenzo Chianese notifications@github.com wrote:Hey,
Looks like angular-hy-res is not rejecting promises when receiving some error from Http server. On the contrary, the promise gets resolved, but the argument of then function is undefined.

Am I missing something?

I am using the internal $promise as reference.

—Reply to this email directly or view it on GitHub.

@XVincentX

This comment has been minimized.

Contributor

XVincentX commented Jun 18, 2015

I mean that I am attaching my handlers (**then, catch) into the $promise property.

@petejohanson

This comment has been minimized.

Owner

petejohanson commented Jun 19, 2015

Give hy-res@0.0.16/angular-hy-res@0.0.23 a shot, it should now reject properly with the resource itself, and propogate the $error property on the resource.

PS - I'm digging the Polls API client, nice seeing this stuff in action.

@XVincentX

This comment has been minimized.

Contributor

XVincentX commented Jun 19, 2015

Works as expected, thank you for the prompt fix.

...and thank you very much for digging into my code. It is unfinished yet (I am on the way to complete a MVP) and I was just thinking about pinging you and ask an opinion about that.

For example, I actually do not like to rely on $promises property, but this is something that I will work on later.

Have you got other thoughts?

Also - is your email on github valid? I'd like to write you something.

@petejohanson

This comment has been minimized.

Owner

petejohanson commented Jun 19, 2015

I only had a chance to quickly scan the code, I'll try to dig in more detail soon.
Yes, that email is fine for reaching me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment