From 9189afe909f0331fb624c2922ad8ab69601fcb9d Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 29 Apr 2021 13:18:35 +0200 Subject: [PATCH] Small improvement --- app/src/main/java/eu/faircode/email/MessageHelper.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 5241460dbb..f328195a34 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -22,6 +22,7 @@ package eu.faircode.email; import android.content.Context; import android.content.SharedPreferences; import android.net.Uri; +import android.system.ErrnoException; import android.text.TextUtils; import androidx.core.net.MailTo; @@ -107,6 +108,8 @@ import javax.mail.internet.ParseException; import biweekly.Biweekly; import biweekly.ICalendar; +import static android.system.OsConstants.ENOSPC; + public class MessageHelper { private boolean ensuredEnvelope = false; private boolean ensuredHeaders = false; @@ -866,7 +869,8 @@ public class MessageHelper { MessageHelper(MimeMessage message, Context context) throws IOException { long cake = Helper.getAvailableStorageSpace(); if (cake < Helper.MIN_REQUIRED_SPACE) - throw new IOException(context.getString(R.string.app_cake)); + throw new IOException(context.getString(R.string.app_cake), + new ErrnoException(context.getPackageName(), ENOSPC)); if (cacheDir == null) cacheDir = context.getCacheDir(); this.imessage = message;