Skip to content

Commit ae6bf10

Browse files
Document expected chat response write suppression
Agent-Logs-Url: https://github.com/IntelliTect/EssentialCSharp.Web/sessions/ca7b0afb-1731-4a50-ac2e-b4d7152c972a Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com>
1 parent 223a9bf commit ae6bf10

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

EssentialCSharp.Web/Controllers/ChatController.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,15 @@ public async Task StreamMessage([FromBody] ChatMessageRequest request, Cancellat
153153
}
154154
catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested || HttpContext.RequestAborted.IsCancellationRequested)
155155
{
156+
// Best-effort write during an aborted request — no response body can be delivered.
156157
}
157158
catch (IOException) when (HttpContext.RequestAborted.IsCancellationRequested)
158159
{
160+
// Expected client disconnect while attempting a best-effort error response write.
159161
}
160162
catch (ObjectDisposedException) when (HttpContext.RequestAborted.IsCancellationRequested)
161163
{
164+
// Response stream can already be disposed after an abrupt client disconnect.
162165
}
163166
}
164167
else
@@ -192,12 +195,15 @@ public async Task StreamMessage([FromBody] ChatMessageRequest request, Cancellat
192195
}
193196
catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested || HttpContext.RequestAborted.IsCancellationRequested)
194197
{
198+
// Best-effort write during an aborted request — no response body can be delivered.
195199
}
196200
catch (IOException) when (HttpContext.RequestAborted.IsCancellationRequested)
197201
{
202+
// Expected client disconnect while attempting a best-effort error response write.
198203
}
199204
catch (ObjectDisposedException) when (HttpContext.RequestAborted.IsCancellationRequested)
200205
{
206+
// Response stream can already be disposed after an abrupt client disconnect.
201207
}
202208
}
203209
catch (Exception ex)

0 commit comments

Comments
 (0)