Improved error reporting

pull/178/head
M66B 5 years ago
parent f36fbe1544
commit a2b8feb836

@ -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,6 +1246,10 @@ public class FragmentRule extends FragmentBase {
@Override @Override
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
if (ex instanceof IllegalArgumentException) {
tvNoMessages.setText(ex.getMessage());
tvNoMessages.setVisibility(View.VISIBLE);
} else
Log.unexpectedError(getParentFragmentManager(), ex); Log.unexpectedError(getParentFragmentManager(), ex);
} }
}.execute(this, args, "rule:check"); }.execute(this, args, "rule:check");

Loading…
Cancel
Save