Map "senderIdMismatch" error as "invalidPushToken" exception in FCM provider (#85)

* Map "senderIdMismatch" error as "invalidPushToken" exception
This commit is contained in:
Artyom 2022-10-25 16:41:43 +03:00 committed by GitHub
parent faf1e92633
commit 723e5a4178
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 5 deletions

View File

@ -13,11 +13,17 @@ class FirebaseMessagingExceptionConverter {
operator fun invoke(exception: FirebaseMessagingException): CommonException {
return when (exception.messagingErrorCode) {
MessagingErrorCode.INVALID_ARGUMENT,
MessagingErrorCode.UNREGISTERED -> InvalidPushTokenException()
else -> PushMessageProviderException(
description = exception.message.orEmpty(),
cause = exception
)
MessagingErrorCode.UNREGISTERED,
MessagingErrorCode.SENDER_ID_MISMATCH -> {
InvalidPushTokenException()
}
else -> {
PushMessageProviderException(
description = exception.message.orEmpty(),
cause = exception
)
}
}
}