added detailed network error message

This commit is contained in:
Mariotaku Lee 2017-07-02 13:52:49 +08:00
parent 2479fc9b47
commit 45a0541533
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
2 changed files with 6 additions and 1 deletions

View File

@ -44,7 +44,11 @@ private fun MicroBlogException.getMicroBlogErrorMessage(context: Context): Strin
val nextResetTime = DateUtils.getRelativeTimeSpanString(System.currentTimeMillis() + secUntilReset)
return context.getString(R.string.error_message_rate_limit, nextResetTime.trim())
} else if (isCausedByNetworkIssue) {
return context.getString(R.string.message_toast_network_error)
val msg = cause?.message
if (msg.isNullOrEmpty()) {
return context.getString(R.string.message_toast_network_error)
}
return context.getString(R.string.message_toast_network_error_with_message, msg)
}
val msg = if (StatusCodeMessageUtils.containsTwitterError(errorCode)) {
StatusCodeMessageUtils.getTwitterErrorMessage(context, errorCode)

View File

@ -677,6 +677,7 @@
<string name="message_toast_login_verification_failed">Login verification failed</string>
<!-- Toast message for network errors -->
<string name="message_toast_network_error">Network error</string>
<string name="message_toast_network_error_with_message">Network error: <xliff:g id="message">%s</xliff:g></string>
<string name="message_toast_no_account">No account</string>
<string name="message_toast_no_account_permission">Account permission is required</string>
<string name="message_toast_no_account_selected">No account selected</string>