MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / extractErrorInfo

Function extractErrorInfo

packages/node-runtime/src/ai/ai-logger.ts:128–143  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

126}
127
128export function extractErrorInfo(error: unknown): Record<string, unknown> {
129 if (error instanceof Error) {
130 const info: Record<string, unknown> = {
131 name: error.name,
132 message: error.message,
133 }
134 if ('cause' in error && error.cause) {
135 info.cause = extractErrorInfo(error.cause)
136 }
137 return info
138 }
139 if (typeof error === 'object' && error !== null) {
140 return { raw: JSON.stringify(error) }
141 }
142 return { message: String(error) }
143}
144
145export function extractErrorStack(error: unknown, stackLines: number = 5): string | null {
146 if (error instanceof Error && error.stack) {

Callers 1

formatDataFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected