Show in-app error code for unknown errors

This commit is contained in:
Naveen 2023-01-03 16:06:23 +05:30
parent 06f6a9ae05
commit 9a515d7fd0
2 changed files with 7 additions and 4 deletions

View File

@ -48,7 +48,10 @@ fun Context.sendMessageCompat(text: String, addresses: List<String>, subId: Int?
when (e.errorCode) {
EMPTY_DESTINATION_ADDRESS -> toast(id = R.string.empty_destination_address, length = LENGTH_LONG)
ERROR_PERSISTING_MESSAGE -> toast(id = R.string.unable_to_save_message, length = LENGTH_LONG)
ERROR_SENDING_MESSAGE -> toast(id = R.string.unknown_error_occurred, length = LENGTH_LONG)
ERROR_SENDING_MESSAGE -> toast(
msg = getString(R.string.unknown_error_occurred_sending_message, e.errorCode),
length = LENGTH_LONG
)
}
} catch (e: Exception) {
showErrorToast(e)

View File

@ -2,8 +2,8 @@ package com.simplemobiletools.smsmessenger.messaging
class SmsException(val errorCode: Int, val exception: Exception? = null) : Exception() {
companion object {
const val EMPTY_DESTINATION_ADDRESS = 0
const val ERROR_PERSISTING_MESSAGE = 1
const val ERROR_SENDING_MESSAGE = 2
const val EMPTY_DESTINATION_ADDRESS = -1
const val ERROR_PERSISTING_MESSAGE = -2
const val ERROR_SENDING_MESSAGE = -3
}
}