Catch Throwable instead of Exception
This commit is contained in:
1 parent
8c3796605e
commit
bfd85e9bc7
17 files changed
+179
-113
No files matched your search
@@ -35,7 +35,7 @@ public final class ExceptionUtils {
|
||||
private static final String TAG = ExceptionUtils.class.getSimpleName();
|
||||
|
||||
@NonNull
|
||||
public static String getReadableString(@NonNull Exception e) {
|
||||
public static String getReadableString(@NonNull Throwable e) {
|
||||
e.printStackTrace();
|
||||
if (e instanceof MalformedURLException) {
|
||||
return GetText.getString(R.string.error_invalid_url);
|
||||
@@ -62,4 +62,15 @@ public final class ExceptionUtils {
|
||||
return GetText.getString(R.string.error_unknown);
|
||||
}
|
||||
}
|
||||
|
||||
public static void throwIfFatal(@NonNull Throwable t) {
|
||||
// values here derived from https://github.com/ReactiveX/RxJava/issues/748#issuecomment-32471495
|
||||
if (t instanceof VirtualMachineError) {
|
||||
throw (VirtualMachineError) t;
|
||||
} else if (t instanceof ThreadDeath) {
|
||||
throw (ThreadDeath) t;
|
||||
} else if (t instanceof LinkageError) {
|
||||
throw (LinkageError) t;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user