Skip to content

Commit aed1186

Browse files
committed
Merge pull request ReactiveX#3361 from artem-zinnatullin/blocking-to-future-better-error-handling
Safer error handling in BlockingOperatorToFuture
2 parents 5b50c3a + 82c13b0 commit aed1186

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/rx/internal/operators/BlockingOperatorToFuture.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,10 @@ public T get(long timeout, TimeUnit unit) throws InterruptedException, Execution
118118
}
119119

120120
private T getValue() throws ExecutionException {
121-
if (error.get() != null) {
122-
throw new ExecutionException("Observable onError", error.get());
121+
final Throwable throwable = error.get();
122+
123+
if (throwable != null) {
124+
throw new ExecutionException("Observable onError", throwable);
123125
} else if (cancelled) {
124126
// Contract of Future.get() requires us to throw this:
125127
throw new CancellationException("Subscription unsubscribed");

0 commit comments

Comments
 (0)