Download src/shared/logging/serialize-error.ts from Bin29/ManimCat: direct link, hf CLI and curl.
- Browser
- Download file 367 Bytes
-
https://huggingface.co/spaces/Bin29/ManimCat/resolve/main/src/shared/logging/serialize-error.ts
- Command line
-
hf download hf://spaces/Bin29/ManimCat/src/shared/logging/serialize-error.ts
-
curl -L -o serialize-error.ts https://huggingface.co/spaces/Bin29/ManimCat/resolve/main/src/shared/logging/serialize-error.ts
367 Bytes
| /** | |
| * Error serializer for structured logging. | |
| */ | |
| export function serializeError(error: unknown): Record<string, unknown> { | |
| if (error instanceof Error) { | |
| return { | |
| name: error.name, | |
| message: error.message, | |
| stack: error.stack, | |
| } | |
| } | |
| if (typeof error === 'string') { | |
| return { message: error } | |
| } | |
| return { value: String(error) } | |
| } | |