Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: endpoint_client configure bug fix #3970

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,33 @@ class EndpointClient {

/// Send local Endpoint instance to AWS Pinpoint.
Future<void> updateEndpoint() async {
Future<void> update({bool throwSessionExpired = false}) async {
try {
await _pinpointClient
.updateEndpoint(
UpdateEndpointRequest(
applicationId: _pinpointAppId,
endpointId: _fixedEndpointId,
endpointRequest: _endpointToRequest(getPublicEndpoint()),
),
)
.result;
} on SessionExpiredException catch (e) {
// rethrow SessionExpiredException so that it can be retried.
if (throwSessionExpired) rethrow;
throw fromPinpointException(e);
} on Exception catch (e) {
throw fromPinpointException(e);
}
}

try {
await _pinpointClient
.updateEndpoint(
UpdateEndpointRequest(
applicationId: _pinpointAppId,
endpointId: _fixedEndpointId,
endpointRequest: _endpointToRequest(getPublicEndpoint()),
),
)
.result;
} on Exception catch (e) {
throw fromPinpointException(e);
await update(throwSessionExpired: true);
} on SessionExpiredException {
// When SessionExpiredException is thrown, the local credential store
// is cleared. At this point the operation should be retired with guest
// credentials.
await update();
}
}

Expand Down