Added search error reporting

pull/72/head
M66B 6 years ago
parent 6244a4557e
commit c7fc14111a

@ -572,7 +572,6 @@ public class FragmentAccount extends FragmentEx {
@Override
protected void onException(Bundle args, Throwable ex) {
Toast.makeText(getContext(), ex.toString(), Toast.LENGTH_LONG).show();
// TODO: recover from error
}
}.load(FragmentAccount.this, args);
}

@ -362,7 +362,6 @@ public class FragmentIdentity extends FragmentEx {
@Override
protected void onException(Bundle args, Throwable ex) {
Toast.makeText(getContext(), ex.toString(), Toast.LENGTH_LONG).show();
// TODO: recover from error
}
}.load(FragmentIdentity.this, args);
}

@ -1,9 +1,12 @@
package eu.faircode.email;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
import android.widget.Toast;
import com.sun.mail.imap.IMAPFolder;
import com.sun.mail.imap.IMAPStore;
@ -88,6 +91,7 @@ public class SearchDataSource extends PositionalDataSource<TupleMessageEx> imple
callback.onResult(result.messages, params.requestedStartPosition, result.total);
} catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
reportError(ex);
}
}
@ -99,6 +103,7 @@ public class SearchDataSource extends PositionalDataSource<TupleMessageEx> imple
callback.onResult(result.messages);
} catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
reportError(ex);
}
}
@ -205,6 +210,15 @@ public class SearchDataSource extends PositionalDataSource<TupleMessageEx> imple
return result;
}
private void reportError(final Throwable ex) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
Toast.makeText(context, Helper.formatThrowable(ex), Toast.LENGTH_LONG).show();
}
});
}
private class SearchResult {
int total;
List<TupleMessageEx> messages;

Loading…
Cancel
Save