-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Currently we share the same catch clause for fetch() and for the shouldRetry() here:
Lines 217 to 227 in 3e512e5
| try { | |
| const response = await fetch(url, options); | |
| if (await shouldRetry(retryOptions, null, response, waitTime)) { | |
| console.error(`Retrying in ${waitTime} milliseconds, attempt ${attempt} failed (status ${response.status}): ${response.statusText}`); | |
| } else { | |
| // response.timeout should reflect the actual timeout | |
| response.timeout = retryOptions.socketTimeout; | |
| return resolve(response); | |
| } | |
| } catch (error) { |
shouldRetry includes calling the callbacks retryOnHttpError() and retryOnHttpResponse(). These callbacks could have developer errors on which we should not retry blindly.
Instead, we should separate the error handling, and for errors on the callbacks pass them through as clear errors (and do not retry) so the developers can fix their code.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working