Use descriptive ErrorMessage for timed out requests#2356
Conversation
When a request times out, ErrorMessage was set to the TaskCanceledException
message ("A task was canceled.") which contradicts ResponseStatus.TimedOut.
Now ErrorMessage says "The request timed out." for timeout scenarios, keeping
all three state properties (ResponseStatus, ErrorMessage, ErrorException)
consistent. ErrorException still holds the original TaskCanceledException.
Fixes #2257
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Review Summary by QodoUse descriptive ErrorMessage for timed out requests
WalkthroughsDescription• Fixes inconsistent ErrorMessage for timed out requests • Sets ErrorMessage to "The request timed out." when timeout occurs • Maintains consistency between ResponseStatus.TimedOut and error message • Preserves original TaskCanceledException in ErrorException Diagramflowchart LR
A["Request times out"] -->|OperationCanceledException| B["Check if TimedOut"]
B -->|Yes| C["ResponseStatus.TimedOut"]
B -->|Yes| D["ErrorMessage: 'The request timed out.'"]
B -->|No| E["ResponseStatus.Aborted"]
B -->|No| F["ErrorMessage: exception message"]
C --> G["Consistent state"]
D --> G
File Changes1. src/RestSharp/RestClient.Async.cs
|
Code Review by Qodo
1. timedOut boolean lacks prefix
|
Deploying restsharp with
|
| Latest commit: |
7fb5c19
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ce3b299c.restsharp.pages.dev |
| Branch Preview URL: | https://fix-timeout-error-message.restsharp.pages.dev |
|




Summary
ErrorMessagenow says"The request timed out."instead of"A task was canceled."ErrorExceptionstill holds the originalTaskCanceledExceptionunchangedResponseStatus.TimedOut+ meaningfulErrorMessage+ originalErrorExceptionFixes #2257
Test plan
🤖 Generated with Claude Code