Skip to main content
Mastra 1.0 is available 🎉 Read announcement

Error Handling

The Mastra Client SDK includes built-in retry mechanism and error handling capabilities.

Error Handling
Direct 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);
}
On this page