Improve onboarding error logging and toast
cgen-2d9f0c54d8f44dc3be0c69a86e99189a
This commit is contained in:
parent
9c46918d94
commit
d9c749a328
1 changed files with 16 additions and 2 deletions
|
|
@ -153,10 +153,24 @@ export default function Onboarding() {
|
||||||
|
|
||||||
navigate("/dashboard", { replace: true });
|
navigate("/dashboard", { replace: true });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Finalize onboarding failed:", e);
|
// Create a readable error message for logging and UI
|
||||||
|
function formatError(err: any) {
|
||||||
|
if (!err) return "Unknown error";
|
||||||
|
if (typeof err === "string") return err;
|
||||||
|
if (err instanceof Error) return err.message + (err.stack ? `\n${err.stack}` : "");
|
||||||
|
if ((err as any).message) return (err as any).message;
|
||||||
|
try {
|
||||||
|
return JSON.stringify(err);
|
||||||
|
} catch {
|
||||||
|
return String(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatted = formatError(e as any);
|
||||||
|
console.error("Finalize onboarding failed:", formatted, e);
|
||||||
aethexToast.error({
|
aethexToast.error({
|
||||||
title: "Onboarding failed",
|
title: "Onboarding failed",
|
||||||
description: (e as any)?.message || "Please try again",
|
description: formatted || "Please try again",
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
setIsFinishing(false);
|
setIsFinishing(false);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue