mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-28 00:20:50 +01:00
Unexpected error handling
This commit is contained in:
@@ -52,6 +52,8 @@ import javax.mail.Address;
|
||||
import javax.mail.FolderClosedException;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
|
||||
|
||||
public class Helper {
|
||||
@@ -122,6 +124,14 @@ public class Helper {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
static void unexpectedError(Context context, Throwable ex) {
|
||||
new AlertDialog.Builder(context)
|
||||
.setTitle(R.string.title_unexpected_error)
|
||||
.setMessage(ex.toString())
|
||||
.setPositiveButton(android.R.string.cancel, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
static String humanReadableByteCount(long bytes, boolean si) {
|
||||
int unit = si ? 1000 : 1024;
|
||||
if (bytes < unit) return bytes + " B";
|
||||
|
||||
Reference in New Issue
Block a user