From 6be297db858ae615ef8f3a96dbc31dd90fe2f759 Mon Sep 17 00:00:00 2001 From: NikaHsn Date: Tue, 24 Oct 2023 09:47:52 -0700 Subject: [PATCH] fix(analytics): event client flush events to do not discard events from cache on auth exception (#3999) --- .../src/impl/analytics_client/event_client/event_client.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/analytics/amplify_analytics_pinpoint_dart/lib/src/impl/analytics_client/event_client/event_client.dart b/packages/analytics/amplify_analytics_pinpoint_dart/lib/src/impl/analytics_client/event_client/event_client.dart index a47e2f31e2..f84a60f46d 100644 --- a/packages/analytics/amplify_analytics_pinpoint_dart/lib/src/impl/analytics_client/event_client/event_client.dart +++ b/packages/analytics/amplify_analytics_pinpoint_dart/lib/src/impl/analytics_client/event_client/event_client.dart @@ -204,6 +204,11 @@ class EventClient implements Closeable { // Due to no internet or unable to reach server. // These exceptions are always retryable. eventsToDelete.clear(); + } on AuthException { + // AuthException indicates request did not complete + // Due to Authentication error. + // These exceptions are always retryable. + eventsToDelete.clear(); } on SmithyHttpException catch (e) { if (e.statusCode != null && _isRetryable(e.statusCode)) { eventsToDelete.removeWhere((eventId, _) {