-
Notifications
You must be signed in to change notification settings - Fork 103
fix(service-error-classification): add TypeError as transient error #1574
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
Conversation
290d3cb
to
d246976
Compare
return false; | ||
} | ||
|
||
return errorMessages.has(error.message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doing a check for messages as well to avoid unintended TypeError
s from being retried
* @internal | ||
*/ | ||
export const isBrowserNetworkError = (error: SdkError) => { | ||
const errorMessages = new Set([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this constant could be placed somewhere else, like the constants file in the same dir. I'd like this here since:
- these are not as strong a check as error codes or status codes, so I want to keep them away from other constants
- this function and its hacky message checks will be easily(-ier?) visible in the future if someone is taking a look at transient errors.
Issue #, if available:
Internal JS-5890
Description of changes:
fetch API surfaces connectivity errors as TypeErrors, example:
TypeError: Failed to fetch
in Chrome.For browsers, we should retry for connectivity issues (offline), this is a fix to retry on TypeErrors then. Since we don't want to retry for
TypeErrors
that aren't network errors, I've paired this check with the actual error messages that different browsers surface (not an exhaustive list, but covers some major ones).Fetch has an open issue about this: whatwg/fetch#526
additional resources
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.