diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index e5e4a58f09..0ba12219c2 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -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); } diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index 3a26a20bfc..7a459e9ad6 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -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); } diff --git a/app/src/main/java/eu/faircode/email/SearchDataSource.java b/app/src/main/java/eu/faircode/email/SearchDataSource.java index daf355837a..e574fcc49e 100644 --- a/app/src/main/java/eu/faircode/email/SearchDataSource.java +++ b/app/src/main/java/eu/faircode/email/SearchDataSource.java @@ -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 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 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 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 messages;