dannyelo
dannyelo4mo ago

Access the action error message when fail

Hello, When I call an action that make a mutation to an external API, and the request fails, I get a Convex Error string, but I need to access the API response error message.
[CONVEX A(organizations_node:updateFacturapiCertificatesAction)] [Request ID: 14d31c10a571998b] Server Error Uncaught Error: El certificado no es un CSD. Asegúrate de no estar enviando una FIEL. at async handler (../convex/organizations_node.ts:230:6) Called by client
[CONVEX A(organizations_node:updateFacturapiCertificatesAction)] [Request ID: 14d31c10a571998b] Server Error Uncaught Error: El certificado no es un CSD. Asegúrate de no estar enviando una FIEL. at async handler (../convex/organizations_node.ts:230:6) Called by client
How can I access only the error string? In this case: El certificado no es un CSD. Asegúrate de no estar enviando una FIEL.
4 Replies
ian
ian4mo ago
In prod the message won’t be sent to the client. Look up ConvexError. search.convex.dev
dannyelo
dannyeloOP4mo ago
Thank you @ian, but how then I get the API response message to the client with an action?
ian
ian4mo ago
If you throw a ConvexError in an action the client will also throw a ConvexError with the same data
dannyelo
dannyeloOP4mo ago
Ok, I'll try that!

Did you find this page helpful?