promise: Handle chaining exceptions
If we run the chain operation on the current thread, don't let any
exception propagate to caller. Handle such exception as they would be
handled in notifyCallbacks.
@@ -173,7 +173,11 @@ abstract class PromiseImpl<T> implements Promise<T> {
*/
static <V> void chain(Promise<V> promise, Runnable chain) {
if (promise.isDone()) {
+ try {
chain.run();
+ } catch (Throwable t) {
+ uncaughtException(t);
+ }
} else {
promise.onResolve(chain);
}
