Skip to content

Conversation

@martincostello
Copy link
Member

Pass the value of timeout to TimeoutRejectedException in Polly for timeout policies.

Resolves #2815.

Pass the value of `timeout` to `TimeoutRejectedException` in Polly for timeout policies.

Resolves #2815.
@martincostello martincostello added this to the v8.6.5 milestone Nov 21, 2025
Copilot AI review requested due to automatic review settings November 21, 2025 21:17
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the TimeoutRejectedException by passing the timeout value that caused the exception, making it easier for consumers to understand and handle timeout scenarios.

  • Timeout parameter is now passed to TimeoutRejectedException in both synchronous and asynchronous timeout engines
  • Tests updated to verify the timeout value is correctly set in the exception

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/Polly/Timeout/TimeoutEngine.cs Updated to pass timeout parameter when throwing TimeoutRejectedException
src/Polly/Timeout/AsyncTimeoutEngine.cs Updated to pass timeout parameter when throwing TimeoutRejectedException in async scenarios
test/Polly.Specs/Timeout/TimeoutSpecs.cs Added test assertion to verify timeout value is set correctly in pessimistic strategy
test/Polly.Specs/Timeout/TimeoutAsyncSpecs.cs Added test assertion to verify timeout value is set correctly in async pessimistic strategy

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.15%. Comparing base (50d19dd) to head (8eae0ff).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2827   +/-   ##
=======================================
  Coverage   96.15%   96.15%           
=======================================
  Files         309      309           
  Lines        7123     7123           
  Branches     1005     1005           
=======================================
  Hits         6849     6849           
  Misses        221      221           
  Partials       53       53           
Flag Coverage Δ
linux 96.15% <100.00%> (ø)
macos 96.15% <100.00%> (ø)
windows 96.14% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@martincostello martincostello merged commit 74bf31f into main Nov 21, 2025
34 checks passed
@martincostello martincostello deleted the gh-2815 branch November 21, 2025 21:27
This was referenced Nov 23, 2025
This was referenced Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: TimeSpan -0.001 in TimeoutRejectedException

2 participants