MCPcopy
hub / github.com/coder/mux / handleStreamFailure

Method handleStreamFailure

src/node/services/streamManager.ts:3064–3081  ·  view source on GitHub ↗

* Persist error state and emit error events for failed streams.

(
    workspaceId: WorkspaceId,
    streamInfo: WorkspaceStreamInfo,
    error: unknown
  )

Source from the content-addressed store, hash-verified

3062 * Persist error state and emit error events for failed streams.
3063 */
3064 private async handleStreamFailure(
3065 workspaceId: WorkspaceId,
3066 streamInfo: WorkspaceStreamInfo,
3067 error: unknown
3068 ): Promise<void> {
3069 streamInfo.state = StreamState.ERROR;
3070
3071 const workspaceLog = this.getWorkspaceLogger(workspaceId, streamInfo);
3072
3073 // Log the actual error for debugging
3074 workspaceLog.error("Stream processing error:", error);
3075
3076 // Record lost previousResponseId so future requests can filter it out
3077 this.recordLostResponseIdIfApplicable(workspaceId, error, streamInfo, workspaceLog);
3078
3079 const errorPayload = this.buildStreamErrorPayload(streamInfo, error);
3080 await this.persistStreamError(workspaceId, streamInfo, errorPayload);
3081 }
3082
3083 private buildStreamErrorPayload(
3084 streamInfo: WorkspaceStreamInfo,

Calls 4

getWorkspaceLoggerMethod · 0.95
persistStreamErrorMethod · 0.95

Tested by

no test coverage detected