Improved error reporting

This commit is contained in:
M66B 2020-04-19 08:08:36 +02:00
parent f36fbe1544
commit a2b8feb836
1 changed files with 15 additions and 3 deletions

View File

@ -1132,7 +1132,6 @@ public class FragmentRule extends FragmentBase {
tvNoMessages.setVisibility(View.GONE); tvNoMessages.setVisibility(View.GONE);
rvMessage.setVisibility(View.GONE); rvMessage.setVisibility(View.GONE);
btnExecute.setVisibility(View.GONE); btnExecute.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);
final Bundle args = new Bundle(); final Bundle args = new Bundle();
args.putLong("folder", folder); args.putLong("folder", folder);
@ -1197,6 +1196,16 @@ public class FragmentRule extends FragmentBase {
}); });
new SimpleTask<List<EntityMessage>>() { new SimpleTask<List<EntityMessage>>() {
@Override
protected void onPreExecute(Bundle args) {
pbWait.setVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(Bundle args) {
pbWait.setVisibility(View.GONE);
}
@Override @Override
protected List<EntityMessage> onExecute(Context context, Bundle args) throws Throwable { protected List<EntityMessage> onExecute(Context context, Bundle args) throws Throwable {
EntityRule rule = new EntityRule(); EntityRule rule = new EntityRule();
@ -1228,7 +1237,6 @@ public class FragmentRule extends FragmentBase {
protected void onExecuted(Bundle args, List<EntityMessage> messages) { protected void onExecuted(Bundle args, List<EntityMessage> messages) {
adapter.set(messages); adapter.set(messages);
pbWait.setVisibility(View.GONE);
if (messages.size() > 0) { if (messages.size() > 0) {
rvMessage.setVisibility(View.VISIBLE); rvMessage.setVisibility(View.VISIBLE);
btnExecute.setVisibility(View.VISIBLE); btnExecute.setVisibility(View.VISIBLE);
@ -1238,7 +1246,11 @@ public class FragmentRule extends FragmentBase {
@Override @Override
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getParentFragmentManager(), ex); if (ex instanceof IllegalArgumentException) {
tvNoMessages.setText(ex.getMessage());
tvNoMessages.setVisibility(View.VISIBLE);
} else
Log.unexpectedError(getParentFragmentManager(), ex);
} }
}.execute(this, args, "rule:check"); }.execute(this, args, "rule:check");