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

Loading…
Cancel
Save