rethrowing the error in handleReturnedServerError loses the orignal error #244
Replies: 3 comments 2 replies
-
Can you provide a link to a minimal reproduction of this issue? Thanks. |
Beta Was this translation helpful? Give feedback.
-
I can't provide the link right now, but what I have is a server action. When the server action encounters an error, like a PrismaClientError, I just throw it, and handleReturnedServerError catches it. Inside handleReturnedServerError, you can still access the original error, but when you rethrow it, the client can no longer access the original error—only the name, digest, and message are accessible. |
Beta Was this translation helpful? Give feedback.
-
I've just tested this by setting up a new project with Prisma + SQLite, and the same thing happens with Server Actions that are not defined using next-safe-action, so I'd say that's not a lib related issue. |
Beta Was this translation helpful? Give feedback.
-
I was throwing an error in my backend and then rethrowing it in the handleReturnedServerError function, but for some reason, it loses the original error, such as when I throw a Prisma error.
Beta Was this translation helpful? Give feedback.
All reactions