ErrCause is like Err() but returns the context cause if backoff is terminated because the context has been canceled.
()
| 68 | // ErrCause is like Err() but returns the context cause if backoff is terminated because the |
| 69 | // context has been canceled. |
| 70 | func (b *Backoff) ErrCause() error { |
| 71 | if b.ctx.Err() != nil { |
| 72 | return context.Cause(b.ctx) |
| 73 | } |
| 74 | return b.Err() |
| 75 | } |
| 76 | |
| 77 | // NumRetries returns the number of retries so far |
| 78 | func (b *Backoff) NumRetries() int { |