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

Method reportStreamError

packages/ai-client/src/chat-client.ts:616–633  ·  view source on GitHub ↗
(error: Error)

Source from the content-addressed store, hash-verified

614 }
615
616 private reportStreamError(error: Error): void {
617 const alreadyReported =
618 this.errorReportedGeneration === this.streamGeneration
619 this.setError(error)
620 // Preserve request-level error semantics even if a RUN_ERROR arrives
621 // slightly after loading flips false during stream teardown.
622 if (
623 this.isLoading ||
624 this.status === 'submitted' ||
625 this.status === 'streaming'
626 ) {
627 this.setStatus('error')
628 }
629 if (!alreadyReported) {
630 this.errorReportedGeneration = this.streamGeneration
631 this.callbacksRef.current.onError(error)
632 }
633 }
634
635 /**
636 * Start the background subscription loop.

Callers 3

constructorMethod · 0.95
startSubscriptionMethod · 0.95
streamResponseMethod · 0.95

Calls 2

setErrorMethod · 0.95
setStatusMethod · 0.95

Tested by

no test coverage detected