MCPcopy
hub / github.com/TanStack/ai / toRunErrorRawEvent

Function toRunErrorRawEvent

packages/ai/src/activities/error-payload.ts:91–108  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

89 * yield { type: EventType.RUN_ERROR, ..., ...(rawEvent !== undefined && { rawEvent }) }
90 */
91export function toRunErrorRawEvent(error: unknown): unknown {
92 if (!error || typeof error !== 'object') return undefined
93 const e = error as {
94 rawEvent?: unknown
95 error?: unknown
96 metadata?: unknown
97 }
98 if (e.rawEvent !== undefined && e.rawEvent !== null) return e.rawEvent
99 if (
100 e.error !== undefined &&
101 e.error !== null &&
102 typeof e.error === 'object'
103 ) {
104 return e.error
105 }
106 if (e.metadata !== undefined && e.metadata !== null) return e.metadata
107 return undefined
108}

Callers 15

chatStreamFunction · 0.85
structuredOutputStreamFunction · 0.85
processStreamChunksFunction · 0.85
chatStreamFunction · 0.85
structuredOutputStreamFunction · 0.85
processStreamChunksFunction · 0.85
chatStreamMethod · 0.85
chatStreamAcpMethod · 0.85
chatStreamNdjsonMethod · 0.85
chatStreamMethod · 0.85
chatStreamMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected