mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
If we have to surface Java exceptions to the user, make them more readable.
This commit is contained in:
parent
dadb966070
commit
1767c3428e
@ -46,6 +46,7 @@ import com.fsck.k9.R;
|
|||||||
import com.fsck.k9.activity.FolderList;
|
import com.fsck.k9.activity.FolderList;
|
||||||
import com.fsck.k9.activity.MessageList;
|
import com.fsck.k9.activity.MessageList;
|
||||||
import com.fsck.k9.helper.NotificationBuilder;
|
import com.fsck.k9.helper.NotificationBuilder;
|
||||||
|
import com.fsck.k9.helper.StringUtils;
|
||||||
import com.fsck.k9.helper.power.TracingPowerManager;
|
import com.fsck.k9.helper.power.TracingPowerManager;
|
||||||
import com.fsck.k9.helper.power.TracingPowerManager.TracingWakeLock;
|
import com.fsck.k9.helper.power.TracingPowerManager.TracingWakeLock;
|
||||||
import com.fsck.k9.mail.Address;
|
import com.fsck.k9.mail.Address;
|
||||||
@ -1731,7 +1732,14 @@ public class MessagingController implements Runnable {
|
|||||||
if (rootCause instanceof MessagingException) {
|
if (rootCause instanceof MessagingException) {
|
||||||
return rootCause.getMessage();
|
return rootCause.getMessage();
|
||||||
} else {
|
} else {
|
||||||
return rootCause.toString();
|
// Remove the namespace on the exception so we have a fighting chance of seeing more of the error in the
|
||||||
|
// notification.
|
||||||
|
String cause = rootCause.toString();
|
||||||
|
if (StringUtils.isNullOrEmpty(cause)) {
|
||||||
|
return cause;
|
||||||
|
} else {
|
||||||
|
return cause.replaceFirst("^[\\w.]+?([\\w]+:)", "$1");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user