debug: include server response in client error
cgen-29bf43e54beb4c27a72b49a2071475bf
This commit is contained in:
parent
234ef0fea8
commit
11ffddcf39
1 changed files with 5 additions and 2 deletions
|
|
@ -137,8 +137,11 @@ export default function Onboarding() {
|
||||||
body: JSON.stringify({ id: user.id, profile: payload }),
|
body: JSON.stringify({ id: user.id, profile: payload }),
|
||||||
});
|
});
|
||||||
if (!ensureResp.ok) {
|
if (!ensureResp.ok) {
|
||||||
const j = await ensureResp.json().catch(() => ({}));
|
const text = await ensureResp.text().catch(() => "");
|
||||||
throw new Error(j.error || "Failed to save profile");
|
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
|
// Fire-and-forget interests via server
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue