JustinBeckwith / retry-axios

🦖 A super flexible interceptor for Axios that makes it easy to retry requests.
Apache License 2.0
490 stars 62 forks source link

Add option to return first error instead of last one #261

Open heidemn-faro opened 5 months ago

heidemn-faro commented 5 months ago

Sometimes, you may want to retry unsafe reqests, e.g. POST. But in this case, it's better to return the first error instead of the last one, otherwise the root cause might be lost.

Example: Our POST API calls another API, and then does something internally.

Currently when using axiosInstance.post with this library, we get the 2nd error instead of the 1st one. That's bad, since it now appears as if the root cause was calling the external API, but the error was actually in our code.

Is there maybe already a workaround to get this behavior?