mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 16:11:20 -08:00
refactor(site): [SITE-CONSOLE-01] restore typed console and lifecycle ownership
This commit is contained in:
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
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user