From 00b33f864d7a43af848c6164e8f9965a774a11b3 Mon Sep 17 00:00:00 2001 From: d-klotz Date: Thu, 12 Feb 2026 14:24:18 -0300 Subject: [PATCH] feat(api): prevent calling setTokens on Zoho API error --- packages/v1-ready/zoho-crm/src/api.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/v1-ready/zoho-crm/src/api.ts b/packages/v1-ready/zoho-crm/src/api.ts index e4a8396..df99119 100644 --- a/packages/v1-ready/zoho-crm/src/api.ts +++ b/packages/v1-ready/zoho-crm/src/api.ts @@ -133,6 +133,11 @@ export class Api extends OAuth2Requester { }; const response = await this._post(options, false); + + if (response.error) { + throw new Error(`[Zoho API] Zoho token exchange failed: ${response.error}`); + } + await this.setTokens(response); return response; }