From 11ffddcf3950c6be1d0e81fba2b137f6bc37a900 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sun, 28 Sep 2025 04:14:24 +0000 Subject: [PATCH] debug: include server response in client error cgen-29bf43e54beb4c27a72b49a2071475bf --- client/pages/Onboarding.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/pages/Onboarding.tsx b/client/pages/Onboarding.tsx index 7f636ae3..efa88d4d 100644 --- a/client/pages/Onboarding.tsx +++ b/client/pages/Onboarding.tsx @@ -137,8 +137,11 @@ export default function Onboarding() { body: JSON.stringify({ id: user.id, profile: payload }), }); if (!ensureResp.ok) { - const j = await ensureResp.json().catch(() => ({})); - throw new Error(j.error || "Failed to save profile"); + const text = await ensureResp.text().catch(() => ""); + let parsedError: any = undefined; + try { parsedError = JSON.parse(text); } catch {} + const message = parsedError?.error || text || `HTTP ${ensureResp.status}`; + throw new Error(message); } // Fire-and-forget interests via server