server error
hello everyone, is it possible to create nuxt server middleware, or something else, that detects code errors so it can display a user-friendly page?
10 Replies
imagine that I have a component on some page, where its props,data, ... , if I don't validate the existence of this props, I will get an error, in production when this happens a server error page is displayed...
In this case, I wanted to display a friendly page, is it possible?
I believe you could create a custom error page and make it user friendly: https://nuxt.com/docs/guide/directory-structure/error
Or if you have client side errrors you could catch them via a hook in a plugin: https://nuxt.com/docs/guide/directory-structure/error
I already have the page, but it doesn't work for these cases of validation errors in the code.
this
This error occurs to me when I forget to validate some props, data, something like that.
I saw that this page is rendered here
It doesn't answer your question but you should not run into such problems if you use eslint.
I use eslint, but in some cases that depend on, for example, a request, this occurs to me because I don't use ts.
Thats even worse to be honest. Don't want to blame you tho.
yes I understand, we are migrating to nuxt 3 and typing our application, but at the moment I wanted to know if it is possible to style this page