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

Function errorStream

packages/ai/tests/stream-to-response.test.ts:230–240  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

228
229 it('should handle stream errors and send error chunk', async () => {
230 async function* errorStream(): AsyncGenerator<StreamChunk> {
231 yield {
232 type: EventType.TEXT_MESSAGE_CONTENT,
233 messageId: 'msg-1',
234 model: 'test',
235 timestamp: Date.now(),
236 delta: 'Test',
237 content: 'Test',
238 }
239 throw new Error('Stream error')
240 }
241
242 const sseStream = toServerSentEventsStream(errorStream())
243 const output = await readStream(sseStream)

Callers 1

Calls 2

nowMethod · 0.80
abortMethod · 0.65

Tested by

no test coverage detected