Catch error thrown while trying to send message, improve debugging

This commit is contained in:
moezbhatti
2019-07-28 00:48:48 -04:00
parent b8fb429dda
commit 797f359725
2 changed files with 13 additions and 9 deletions
@@ -304,13 +304,18 @@ class MessageRepositoryImpl @Inject constructor(
if (prefs.delivery.get()) pendingIntent else null
}
smsManager.sendMultipartTextMessage(
message.address,
null,
parts,
ArrayList(sentIntents),
ArrayList(deliveredIntents)
)
try {
smsManager.sendMultipartTextMessage(
message.address,
null,
parts,
ArrayList(sentIntents),
ArrayList(deliveredIntents)
)
} catch (e: IllegalArgumentException) {
Timber.w(e, "Message body lengths: ${parts.map { it.length }}")
markFailed(message.id, Telephony.MmsSms.ERR_TYPE_GENERIC)
}
}
override fun cancelDelayedSms(id: Long) {