jdeferred / jdeferred

Java Deferred/Promise library similar to JQuery.

Home Page:jdeferred.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DeferredFutureTask and global CallbackExceptionHandler

aalmiray opened this issue · comments

DeferredFutureTask has a pair of TODOs stating the need of re-routing an exception through CallbackExceptionHandler.. Problem is, the exception may occur during resolve or cleanup thus they do not occur under any of the 4 types of callbacks currently handled by CEH.

Good thing I renamed the global exception handler to CallbackExceptionHandler. We can have a CancellationExceptionHandler?

ah, i think it's referring to https://github.com/jdeferred/jdeferred/blob/2.x/subprojects/jdeferred-core/src/main/java/org/jdeferred2/DeferredFutureTask.java#L188-L191

this might never happen since exceptions are handled by the global exception handler already in each of the calls, right?

If that's the case, would you prefer to have a new CallbackType for CANCEL_CALLBACK, and re-use the CallbackExceptionHandler?

The thrown Throwablemay occur during deferred.resolve(get());. Given the previous catch blocks for InterruptedException and ExecutionException then the third catch will handle any other plumbing error.

I'd say let's keep it as is for the time being.