From 121456cc8c35fe22fafa6fedc1844f90266f75fa Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 18 Oct 2020 18:39:46 +0200 Subject: [PATCH] Who ate the cake? --- app/src/main/java/eu/faircode/email/FragmentCompose.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index afed3196ca..16fc27d0cc 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -54,6 +54,7 @@ import android.provider.MediaStore; import android.provider.Settings; import android.security.KeyChain; import android.security.KeyChainException; +import android.system.ErrnoException; import android.text.Editable; import android.text.Html; import android.text.SpannableStringBuilder; @@ -205,6 +206,7 @@ import biweekly.property.Organizer; import static android.app.Activity.RESULT_CANCELED; import static android.app.Activity.RESULT_FIRST_USER; import static android.app.Activity.RESULT_OK; +import static android.system.OsConstants.ENOSPC; import static android.widget.AdapterView.INVALID_POSITION; public class FragmentCompose extends FragmentBase { @@ -2270,8 +2272,13 @@ public class FragmentCompose extends FragmentBase { else if (ex instanceof IllegalArgumentException || ex instanceof FileNotFoundException) Snackbar.make(view, ex.toString(), Snackbar.LENGTH_LONG) .setGestureInsetBottomIgnored(true).show(); - else + else { + if (ex instanceof IOException && + ex.getCause() instanceof ErrnoException && + ((ErrnoException) ex.getCause()).errno == ENOSPC) + ex = new Throwable(getContext().getString(R.string.app_cake), ex); Log.unexpectedError(getParentFragmentManager(), ex); + } } }.execute(this, args, "compose:attachment:add"); }