Skip to content

Commit

Permalink
chore(shorebird_cli): add http.ClientException to list of retry-abl…
Browse files Browse the repository at this point in the history
…e errors (#945)
  • Loading branch information
bryanoltman authored Jul 28, 2023
1 parent b0b520a commit 4ac96fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ http.Client retryingHttpClient(http.Client client) => RetryClient(

bool isRetryableException(Object exception, StackTrace _) {
return switch (exception.runtimeType) {
http.ClientException => true,
HttpException => true,
TlsException => true,
SocketException => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ void main() {
);
});

test('returns true on http.ClientException', () {
expect(
isRetryableException(http.ClientException(''), StackTrace.empty),
isTrue,
);
});

test('returns false on arbitrary exception', () {
expect(isRetryableException(Exception(), StackTrace.empty), isFalse);
});
Expand Down

0 comments on commit 4ac96fd

Please sign in to comment.