Error Handling
The Mastra Client SDK includes built-in retry mechanism and error handling capabilities.
Error HandlingDirect link to Error Handling
All API methods can throw errors that you can catch and handle:
try {
const agent = mastraClient.getAgent('agent-id')
const response = await agent.generate('Hello')
} catch (error) {
console.error('An error occurred:', error.message)
}