diff --git a/app-notifier/src/main/kotlin/org/ostelco/prime/appnotifier/FirebaseAppNotifier.kt b/app-notifier/src/main/kotlin/org/ostelco/prime/appnotifier/FirebaseAppNotifier.kt index 79d8d73bc..4d11c43bb 100644 --- a/app-notifier/src/main/kotlin/org/ostelco/prime/appnotifier/FirebaseAppNotifier.kt +++ b/app-notifier/src/main/kotlin/org/ostelco/prime/appnotifier/FirebaseAppNotifier.kt @@ -92,12 +92,15 @@ class FirebaseAppNotifier: AppNotifier { override fun onFailure(t: Throwable) { if (t is FirebaseMessagingException) { val errorCode = t.errorCode - logger.warn("Notification for $customerId with appId: ${token.applicationID} " + - "failed with errorCode: $errorCode") if (listOfFailureCodes.contains(errorCode)) { - logger.warn("Removing failed token for $customerId with appId: ${token.applicationID} " + + // Known failure, we should remove this token from our list + logger.info("Removing failed token (errorCode: $errorCode) for $customerId with appId: ${token.applicationID} " + "token: $token.token") store.removeNotificationToken(customerId, token.applicationID) + } else { + // Other failures we should look into. + logger.warn("Notification for $customerId with appId: ${token.applicationID} " + + "failed with errorCode: $errorCode") } } else { logger.warn("Notification for $customerId with appId: ${token.applicationID} " +