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

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

Open
heidemn-faro opened this issue Jun 14, 2024 · 0 comments
Open

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

heidemn-faro opened this issue Jun 14, 2024 · 0 comments

Comments

@heidemn-faro
Copy link

heidemn-faro commented Jun 14, 2024

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.

  • 1st try: Calling other API succeeds, and our stuff fails
  • 2nd try (retried by this library): Calling other API fails now because preconditions are no longer fulfilled.

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?

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

No branches or pull requests

1 participant