context.WithTimeoutCause derives a context that expires after a duration and records a specified error cause. When the timeout wins, ctx.Done() becomes readable; use context.Cause(ctx) to retrieve the supplied cause instead of the ambiguous ctx.Err(). section 10.6.3
Use the pattern to make bounded operations observable and testable:
- Prefer context.Cause(ctx) when a specific timeout cause matters; ctx.Err() may only report context.DeadlineExceeded. section 10.6.3
