Get error code from $fetch
How can I get the error code from $fetch when a request fails?
I need to do call different methods based on the type of error.
I have server route that returns a promise like this, but it only logs the error message and doesn't give any other information:
6 Replies
Anyone?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Doesn't work as error object is undefined
GitHub
Add an option to allow http errors · Issue #207 · unjs/ofetch
ofetch by default throws an error if the response status code is any of http standard error codes (such as 50x). However there are situations that users prefer to always get it as a response. Curre...
Just have to wait for this update I guess
it's error.data I think