Retrieve error status code and display error on page
I'm trying to get some error handling logic to work. I have this pipeline:
Which logs the following:
So it's seemingly creating the Nuxt error, but the message or status code doesn't seem to match. This is the fetch function in my page that calls this event handler:
Ideally I want to be able to know when the error was created and display a custom error message to handle it on the front-end.
This might have a pretty simple answer, but I'm not really sure how to approach this
1 Reply
I tried doing this:
And it logs the error, but the status seems to be 500 instead of the 404 that I am trying to make it have
setResponseStatus
doesn't seem to work either;
This actually does change the statusText
, but not the status itself. I can confirm e.response.status
is 404 as well indeed.
I see this as well.