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?
Then this block may not be needed https://github.com/jdeferred/jdeferred/blob/2.x/subprojects/jdeferred-core/src/main/java/org/jdeferred/DeferredFutureTask.java#L180-L183
trying to lookup the code in the new package, but i don't think this is it: https://github.com/jdeferred/jdeferred/blob/2.x/subprojects/jdeferred-core/src/main/java/org/jdeferred2/DeferredFutureTask.java#L180-L183
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 Throwable
may 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.