RxJava gracefully handles intercepted InterruptedException instead of crashing

This commit is contained in:
2026-09-22 21:48:01 -07:00
committed by Tom
parent 71a2146c4b
commit 85aafd8a02

View File

@@ -290,8 +290,13 @@ public class MainActivity extends AppCompatActivity {
SnackbarHelper.showLong(rootView, getString(R.string.snackbar_import_source_complete, resultCount, source.projectName)); SnackbarHelper.showLong(rootView, getString(R.string.snackbar_import_source_complete, resultCount, source.projectName));
}, throwable -> { }, throwable -> {
snackbar.dismiss(); snackbar.dismiss();
if (throwable instanceof InterruptedException) {
Logger.logError("Import task was cancelled: " + source.projectName, throwable);
// The user cancelled via UI, message handled in the snackbar action.
} else {
Logger.logError("Failed to import from source: " + source.projectName, throwable); Logger.logError("Failed to import from source: " + source.projectName, throwable);
SnackbarHelper.showLong(rootView, getString(R.string.snackbar_import_source_failed, source.projectName)); SnackbarHelper.showLong(rootView, getString(R.string.snackbar_import_source_failed, source.projectName));
}
}); });
} }