N
Nuxt5mo ago
Nin

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
Nin
NinOP5mo ago
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?
Niklas
Niklas5mo ago
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
Nin
NinOP5mo ago
I already have the page, but it doesn't work for these cases of validation errors in the code.
Nin
NinOP5mo ago
this
No description
Nin
NinOP5mo ago
This error occurs to me when I forget to validate some props, data, something like that. I saw that this page is rendered here
Nin
NinOP5mo ago
No description
No description
Single
Single5mo ago
It doesn't answer your question but you should not run into such problems if you use eslint.
Nin
NinOP5mo ago
I use eslint, but in some cases that depend on, for example, a request, this occurs to me because I don't use ts.
Single
Single5mo ago
Thats even worse to be honest. Don't want to blame you tho.
Nin
NinOP5mo ago
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
Want results from more Discord servers?
Add your server