Skip to content

Commit

Permalink
Don't assume error has a name property.
Browse files Browse the repository at this point in the history
  • Loading branch information
wparad committed Nov 13, 2023
1 parent 1dcd8b0 commit da022d1
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/httpClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ const errorMessages = new Set([
]);

function isNetworkError(error) {
const isValid = error && error.name === 'TypeError' && typeof error.message === 'string';

if (!isValid) {
return false;
}

return errorMessages.has(error.message);
return error && error.message && errorMessages.has(error.message);
}

async function retryExecutor(func) {
Expand Down

0 comments on commit da022d1

Please sign in to comment.