MCPcopy Create free account
hub / github.com/TanStack/ai / normalizeCode

Function normalizeCode

packages/ai-openrouter/src/adapters/responses-text.ts:1903–1907  ·  view source on GitHub ↗

Normalize an `error.code` to the string slot our RUN_ERROR event reads.

(code: unknown)

Source from the content-addressed store, hash-verified

1901
1902/** Normalize an `error.code` to the string slot our RUN_ERROR event reads. */
1903function normalizeCode(code: unknown): string | undefined {
1904 if (typeof code === 'string') return code
1905 if (typeof code === 'number' && Number.isFinite(code)) return String(code)
1906 return undefined
1907}
1908
1909export function createOpenRouterResponsesText<
1910 TModel extends OpenRouterResponsesTextModels,

Callers 2

processStreamChunksMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected