Descriptive server component error.
Unanswered
Sander posted this in #help-forum
SanderOP
is there a way to get slightly more descriptive server side errors to the client?
This might be a generic message according to Next docs but its super user unfriendly.
This makes me assume you either should return notFound() or hard code your own generic message. I was hoping to give the user some descriptivr error message such as 'invalid input' ect.
An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.This might be a generic message according to Next docs but its super user unfriendly.
This makes me assume you either should return notFound() or hard code your own generic message. I was hoping to give the user some descriptivr error message such as 'invalid input' ect.
3 Replies
@Sander is there a way to get slightly more descriptive server side errors to the client?
An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.
This might be a generic message according to Next docs but its super user unfriendly.
This makes me assume you either should return notFound() or hard code your own generic message. I was hoping to give the user some descriptivr error message such as 'invalid input' ect.
it is purposefully not descriptive, as it mentions: "to avoid leaking sensitive details"... you shouldn't be creating those types of errors anyway... can you share more of what you want to create (with current code), as i don't know how you are implementing the input
SanderOP
Its an arbitrary example, error could be anything. In our case its a package tracking form. We set the values in query params and go to /history, there if the input is invalid I'd like to return a specific error we get from the server.
The page is server rendered.
The page is server rendered.
Yes in this case notfound is perfect but lets say it was something else.