From 5afea1c72789e979cb43c29a0cfcf1becc46c377 Mon Sep 17 00:00:00 2001 From: ivirtex Date: Thu, 26 Oct 2023 01:06:00 +0200 Subject: [PATCH] Log NotificationsApi exceptions --- .../lib/src/notifications_repository.dart | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/notifications_repository/lib/src/notifications_repository.dart b/packages/notifications_repository/lib/src/notifications_repository.dart index 3c6b284..e9a4ae6 100644 --- a/packages/notifications_repository/lib/src/notifications_repository.dart +++ b/packages/notifications_repository/lib/src/notifications_repository.dart @@ -69,15 +69,27 @@ class NotificationsRepository { if (activityPushToken != state.activityToken) { activityPushToken = state.activityToken; - await _notificationsApi - .sendLiveActivityPushToken(state.activityToken); + try { + await _notificationsApi + .sendLiveActivityPushToken(state.activityToken); + } catch (e) { + log('Failed to send push token', error: e); + + rethrow; + } } }, // ignore: body_might_complete_normally_nullable ended: (state) async { log('Activity is inactive, invalidating token'); - await _notificationsApi.invalidateLiveActivityPushToken(id); + try { + await _notificationsApi.invalidateLiveActivityPushToken(id); + } catch (e) { + log('Failed to invalidate push token', error: e); + + rethrow; + } }, ), );