diff options
Diffstat (limited to 'app/routes')
| -rw-r--r-- | app/routes/auth.register.tsx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/routes/auth.register.tsx b/app/routes/auth.register.tsx index 7d8fb5d..43e9c71 100644 --- a/app/routes/auth.register.tsx +++ b/app/routes/auth.register.tsx @@ -132,12 +132,18 @@ export default function Register() { body: JSON.stringify({ token }), }); setStep("1b. fetch 完了 status=" + optRes.status); await tick(); + const rawText = await optRes.text(); + setStep("1c. body=" + rawText.slice(0, 120)); await tick(); if (!optRes.ok) { - const err = await optRes.json(); - throw new Error(err.error ?? "オプション取得に失敗しました"); + throw new Error("HTTP " + optRes.status + ": " + rawText.slice(0, 200)); } - const optJSON = await optRes.json(); - setStep("1c. JSON パース OK"); await tick(); + let optJSON: Record<string, unknown>; + try { + optJSON = JSON.parse(rawText); + } catch (e) { + throw new Error("JSON.parse 失敗: " + String(e) + " | body: " + rawText.slice(0, 100)); + } + setStep("1d. JSON パース OK"); await tick(); const userId = b64urlToBuffer(optJSON.user.id); const challenge = b64urlToBuffer(optJSON.challenge); |
