Skip to content
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

With multiple results it is hard to access the cause of the failure #113

Closed
tbee opened this issue Jun 7, 2017 · 7 comments
Closed

With multiple results it is hard to access the cause of the failure #113

tbee opened this issue Jun 7, 2017 · 7 comments
Assignees
Milestone

Comments

@tbee
Copy link

tbee commented Jun 7, 2017

On normal calls, the fail method has the exception as the parameter. When syncing multiple calls, the fail method returns a OneReject instance. But it is not easy (if even possible) to access the exception causing the failure through that instance.
https://github.com/jdeferred/jdeferred/blob/master/subprojects/jdeferred-core/src/main/java/org/jdeferred/multiple/OneReject.java

@saturnism
Copy link
Member

saturnism commented Jun 7, 2017 via email

@tbee
Copy link
Author

tbee commented Jun 8, 2017

This is not about type safety; I just want to know what caused the fail to be called. The 'normal' fail gets the causing exception as a parameter, where is it hidden here? ... Hmm, is it maybe the reject value in OneReject?

@saturnism
Copy link
Member

saturnism commented Jun 8, 2017 via email

@tbee
Copy link
Author

tbee commented Jun 8, 2017

Ok. I see. And I see that the other fail method also has a parameter of type Object. Isn't that always a Throwable or Exception?

@saturnism
Copy link
Member

not quite, you can reject with a non-Exception. E.g., deferred.reject("failed")

However, if you let DeferredManager to create a promise from a Callable, then the rejection is always an Exception.

@tbee
Copy link
Author

tbee commented Jun 8, 2017

Ok! With the javascript roots I get that. I would have wrapped that reject in an exception so the API would be identical. Butthat explains it. Thanks.

@saturnism saturnism added this to the 2.0 milestone Jun 21, 2017
@saturnism saturnism self-assigned this Jun 21, 2017
@saturnism
Copy link
Member

Sounds like we were good. Closing for now :) Thanks!

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

No branches or pull requests

2 participants