MCPcopy Create free account
hub / github.com/TanStack/router / encodeErrorPayload

Function encodeErrorPayload

packages/start-server-core/src/frame-protocol.ts:63–71  ·  view source on GitHub ↗

Encodes an error message payload, truncated to a bounded length.

(error: unknown)

Source from the content-addressed store, hash-verified

61
62/** Encodes an error message payload, truncated to a bounded length. */
63function encodeErrorPayload(error: unknown): Uint8Array {
64 const originalMessage =
65 error instanceof Error ? error.message : String(error ?? 'Unknown error')
66 const message =
67 originalMessage.length > MAX_ERROR_MESSAGE_CODE_UNITS
68 ? `${originalMessage.slice(0, MAX_ERROR_MESSAGE_CODE_UNITS)}…`
69 : originalMessage
70 return textEncoder.encode(message)
71}
72
73/**
74 * Late stream registration for RawStreams discovered after serialization starts.

Callers 1

pumpRawStreamFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected