Checking error details in error boundaries
Unanswered
Chinese Alligator posted this in #help-forum
Chinese AlligatorOP
I'd like to be able to use the error boundary in error.js to catch and identify the cause using the message field.
For example: a bunch of my api/fetch calls in async server components can potentially throw an error with the message FORBIDDEN in which case I'd like to detect if this is the case and show a <Forbidden /> page.
This is possible in dev, however Next.js replaces the error's message in prod for security reasons. Is it possible to disable this? or what is the idiomatic way of achieving this
For example: a bunch of my api/fetch calls in async server components can potentially throw an error with the message FORBIDDEN in which case I'd like to detect if this is the case and show a <Forbidden /> page.
This is possible in dev, however Next.js replaces the error's message in prod for security reasons. Is it possible to disable this? or what is the idiomatic way of achieving this