Expected exceptions

pull/190/head
M66B 4 years ago
parent 6c00f0e922
commit 522af0c756

@ -686,11 +686,11 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
@Override @Override
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
if (ex instanceof IllegalArgumentException || boolean expected =
ex instanceof FileNotFoundException) (ex instanceof IllegalArgumentException ||
ToastEx.makeText(ActivitySetup.this, ex.getMessage(), Toast.LENGTH_LONG).show(); ex instanceof FileNotFoundException ||
else ex instanceof SecurityException);
Log.unexpectedError(getSupportFragmentManager(), ex); Log.unexpectedError(getSupportFragmentManager(), ex, !expected);
} }
}.execute(this, args, "setup:export"); }.execute(this, args, "setup:export");
} }
@ -1073,12 +1073,14 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
ToastEx.makeText(ActivitySetup.this, R.string.title_setup_password_invalid, Toast.LENGTH_LONG).show(); ToastEx.makeText(ActivitySetup.this, R.string.title_setup_password_invalid, Toast.LENGTH_LONG).show();
else if (ex instanceof IOException && ex.getCause() instanceof IllegalBlockSizeException) else if (ex instanceof IOException && ex.getCause() instanceof IllegalBlockSizeException)
ToastEx.makeText(ActivitySetup.this, R.string.title_setup_import_invalid, Toast.LENGTH_LONG).show(); ToastEx.makeText(ActivitySetup.this, R.string.title_setup_import_invalid, Toast.LENGTH_LONG).show();
else if (ex instanceof IllegalArgumentException || else {
ex instanceof FileNotFoundException || boolean expected =
ex instanceof JSONException) (ex instanceof IllegalArgumentException ||
ToastEx.makeText(ActivitySetup.this, ex.getMessage(), Toast.LENGTH_LONG).show(); ex instanceof FileNotFoundException ||
else ex instanceof JSONException ||
Log.unexpectedError(getSupportFragmentManager(), ex); ex instanceof SecurityException);
Log.unexpectedError(getSupportFragmentManager(), ex, !expected);
}
} }
}.execute(this, args, "setup:import"); }.execute(this, args, "setup:import");
} }
@ -1145,7 +1147,8 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
@Override @Override
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getSupportFragmentManager(), ex, false); boolean expected = (ex instanceof SecurityException);
Log.unexpectedError(getSupportFragmentManager(), ex, !expected);
} }
}.execute(this, args, "setup:cert"); }.execute(this, args, "setup:cert");
} }

Loading…
Cancel
Save