refactor(site): [SITE-CONSOLE-01] restore typed console and lifecycle ownership

This commit is contained in:
Harvey Zhao committed 2026-09-15 06:15:32 +08:00
1 parent 6cd2d0ffbe
commit 3dba82a453
29 files changed
+1884 -36

No files matched your search

@@ -0,0 +1,17 @@
export function errorArgument(value: unknown): unknown {
try {
if (Object.prototype.toString.call(value) !== '[object Error]')
return value
const error = value as Error
const stack = error.stack
const message = error.message
if (typeof stack !== 'string' || !message)
return value
const header = error.name ? `${error.name}: ${message}` : message
return stack.startsWith(header) ? value : `${header}\n${stack}`
}
catch {
// Keep the legacy parser's behavior for unusual throwing Error getters.
return value
}
}