Replies: 1 comment
-
This is the best workaround I've found in the meantime: https://joulev.dev/blogs/throwing-expected-errors-in-react-server-actions |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
Background
https://rc.nextjs.org/docs/app/building-your-application/routing/error-handling discusses recommendations for Server Actions, but as far as I can tell there are no options for server components (e.g. fetch errors). You end up with workarounds like #66999 (reply in thread) I don't want to put try..catch blocks everywhere.
The goal is to access the full server-side error for logging purposes, not the "specific message is omitted in production" message.
Proposal
Just as we can write client-side error handlers, let us do this server-side. Make it consistent; not
useActionState
in Server Actions and try..catch in Server Components. Add one server-side event or file that handles everything. Most production apps are going to use some error-handling service; let us catch unhandled errors in one place.Beta Was this translation helpful? Give feedback.
All reactions