Velz
Velz3mo ago

How to handle ConvexError on client?

Hi, Following the docs on Application Errors, I am throwing new ConvexError('here's Error') in my mutation, and on client try to catch it in this way
try {
myMutation();
} catch (e: unknown) {
if (e instanceof ConvexError){
console.log(e.data);
}
}
try {
myMutation();
} catch (e: unknown) {
if (e instanceof ConvexError){
console.log(e.data);
}
}
However, it does not seem to be working. I see Uncaught ConvexError in my console, but I am not able to handle it on the client for some reason. I also. tried to follow what AI docs suggested: checking for whether data is present inside the e, but that also isn't working. Curious if there are any gotchas I might be missing? Thanks!
1 Reply
Convex Bot
Convex Bot3mo ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!

Did you find this page helpful?