Next.js Discord

Discord Forum

Descriptive server component error.

Unanswered
Sander posted this in #help-forum
Open in Discord
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.

3 Replies

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.
Yes in this case notfound is perfect but lets say it was something else.