softonic/axios-retry

Is there any way to check response of last retry?

Opened this issue · 1 comments

I wonder if there is any way to check the response of the last retry, because using an axios error interceptor gets executed at every retry.

the response of the last retry

After the maximum retries are reached, the error is not retried and the error is reject.
Therefore, the response at the last retry can be seen in the catch block of the following example.

https://github.com/softonic/axios-retry/blob/master/es/index.mjs#L254C12-L254C34

import axios from 'axios';
import axiosRetry from 'axios-retry';

axiosRetry(axios);

try { 
  axios.get(...); // for example, if a 500 error occurs, the default is 3 retries, and if it is still an error, the process moves to the catch block.
} catch (e) {
   console.error(e); // <- e is AxiosError and e is the response of the last retry
}

I would appreciate it if you could point out if my post is not in line with the intent of the question.