2 Replies
The above is how I'm handling it now too. Made a separate function
parseError
to do the type checking so I wouldn't have to put the boilerplate there all the time, but this is the recommended way to handle errors in a try/catch regardless of using Nuxt or not. You should double check which fields you want from the object by inspecting the FetchError
type (such as statusMessage
).