メインコンテンツへ移動

エラー処理

Mastra Client SDK には、再試行メカニズムとエラー処理機能が組み込まれています。

エラー処理
エラー処理への直接リンク

すべての API メソッドはエラーをスローする可能性があり、エラーをキャッチして処理できます。

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