jdeferred / jdeferred

Java Deferred/Promise library similar to JQuery.

Home Page:jdeferred.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

tbee opened this issue · comments

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

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?

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?

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.

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.

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