Llabe
Llabe11mo ago

Catching ConvexError on the frontend

Has anyone tried to get the convex error message in the front-end? For example doing a mutation (Inside the mutation I throw a ConvexError but the message I receive in the front when I catch it is a big string with a lot of data, not just the messag).
4 Replies
ballingt
ballingt11mo ago
What's your catching code look like, and how are you turning the error object into a string?
Llabe
LlabeOP11mo ago
I am using a try/catch block. The error being catch is a ConvexError. And when I do error.message, I get something like this: ConvexError: [CONVEX M(invitations:createInvitation)] [Request ID: 508b65e3043a038d] Server Error Uncaught ConvexError: User not found at handler (../convex/invitations.ts:46:10) Called by client And the Idea would be to get the "User not found" This is to invite users to something. And there are multiple possible error (not found, already a member, etc...)
lee
lee11mo ago
Application Errors | Convex Developer Hub
If you have expected ways your functions might fail, you can either return
Llabe
LlabeOP11mo ago
Thanks

Did you find this page helpful?