From 2bf13cc56e71d47654897b929acabbc73b3722c6 Mon Sep 17 00:00:00 2001 From: Mahesh Sanikommu Date: Sat, 20 Jun 2026 02:22:34 -0700 Subject: [PATCH] fix(web): handle non-OK/non-JSON errors in brain connection link --- apps/web/components/settings/company-brain-connections.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/web/components/settings/company-brain-connections.tsx b/apps/web/components/settings/company-brain-connections.tsx index 734dabfc..b9045e8b 100644 --- a/apps/web/components/settings/company-brain-connections.tsx +++ b/apps/web/components/settings/company-brain-connections.tsx @@ -221,9 +221,15 @@ export default function CompanyBrainConnections() { toast.error("Only admins can connect the shared org account.") return } + if (!res.ok) { + toast.error("Couldn't start the connection.") + return + } const data = (await res.json()) as { url?: string; error?: string } if (data.url) window.open(data.url, "_blank", "noopener") else toast.error(data.error ?? "Couldn't start the connection.") + } catch { + toast.error("Couldn't start the connection.") } finally { setBusy(null) }