Is the try catch useful for an async api call? If the promise rejects, the catch will not be triggered.
There is actually situations where using axios, “try/catch” & async/await can cause unwanted behaviour. At least for me it did. E.g. when using interceptors a failed request might not end up in catch.
Nevermind, just read it does actually throw :D
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Is the try catch useful for an async api call? If the promise rejects, the catch will not be triggered.
There is actually situations where using axios, “try/catch” & async/await can cause unwanted behaviour.
At least for me it did.
E.g. when using interceptors a failed request might not end up in catch.
Nevermind, just read it does actually throw :D