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

Access axios-retry configuration from the error object and fix its types #166

Closed
jrmyio opened this issue Apr 16, 2021 · 1 comment · Fixed by #248
Closed

Access axios-retry configuration from the error object and fix its types #166

jrmyio opened this issue Apr 16, 2021 · 1 comment · Fixed by #248

Comments

@jrmyio
Copy link

jrmyio commented Apr 16, 2021

I am trying to add some logging by using the retryCondition as proposed in #134 (comment).

In the message I want to log the current retryCount and the total retries.
For example: 'Re-trying {url} (1/3 tries)'.

However, I cannot access the 'retries' config variable (which is the total amount of retries) from the AxiosError object.

There seems to be a AxiosError.config['axios-retry'] in the error object that according to its types should match IAxiosRetry.IAxiosRetryConfig. Instead the AxiosError.config['axios-retry'] seems to contain a shape of
{ retryCount: number, lastRequestTime: number}.

It would be great if the { retryCount: number, lastRequestTime: number} is either merged with the existing IAxiosRetry.IAxiosRetryConfig, or use a different variable name instead.

@rgoomes
Copy link

rgoomes commented Sep 28, 2022

t would be great if the { retryCount: number, lastRequestTime: number} is either merged with the existing IAxiosRetry.IAxiosRetryConfig, or use a different variable name instead.

This. I believe retry-axios does this and export the type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants