error.tsx error boundaries not working for server actions
Unanswered
Sloth bear posted this in #help-forum
Sloth bearOP
I am writing a Next.js app using App Router, and have the files
However, the error is not being caught by the error boundary, even though the error is being thrown. I've also seen a lot of discussion online about catch errors and returning them, but I believe this is just if I need to handle specific errors differently and display certain error messages. Is the documentation I linked above incorrect? I have just copy/pasted the files from those links, but no luck. Thank you for the help!
foo/bar/actions.ts, foo/bar/error.tsx, and foo/bar/page.tsx. According to much of the official Next.js documentation I've seen (https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations#error-handling and https://nextjs.org/learn/dashboard-app/error-handling are the two most notable), it seems as though throwing an error from the actions.ts should be caught by the error.tsx error boundary and handled elegantly (even though the error message will be a generic server error message, which is fine).However, the error is not being caught by the error boundary, even though the error is being thrown. I've also seen a lot of discussion online about catch errors and returning them, but I believe this is just if I need to handle specific errors differently and display certain error messages. Is the documentation I linked above incorrect? I have just copy/pasted the files from those links, but no luck. Thank you for the help!