Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#781) Filter out InterruptedExceptions coming into RxJava onError handler inside RuntimeExceptions #782

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ public void onCreate() {
// fine, some blocking code was interrupted by a dispose call
return;
}
if (e instanceof RuntimeException && e.getCause() instanceof InterruptedException) {
// fine, DB synchronous call (via runTask) was interrupted when a reactive stream
// was disposed of.
return;
}
if (e instanceof FileCacheException.CancellationException
|| e instanceof FileCacheException.FileNotFoundOnTheServerException) {
// fine, sometimes they get through all the checks but it doesn't really matter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,12 @@ public <T> void runTaskAsync(final Callable<T> taskCallable, final TaskResult<T>
public <T> T runTask(final Callable<T> taskCallable) {
try {
return executeTask(taskCallable, null).get();
} catch (InterruptedException | ExecutionException e) {
} catch (InterruptedException e) {
// Since we don't rethrow InterruptedException we need to at least restore the
// "interrupted" flag.
Thread.currentThread().interrupt();
throw new RuntimeException(e);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
}
Expand Down