IsTimeout returns a boolean indicating whether the error is known to report that a timeout occurred. This function differs from os.IsTimeout() in that it can identify an error through wrapping layers.
(err error)
| 111 | // This function differs from os.IsTimeout() in that it |
| 112 | // can identify an error through wrapping layers. |
| 113 | func IsTimeout(err error) bool { |
| 114 | // os.IsTimeout() cannot peek through Unwrap. We need errors.If() |
| 115 | // for that. |
| 116 | _, ok := errors.If(err, func(err error) (interface{}, bool) { |
| 117 | return nil, os.IsTimeout(err) |
| 118 | }) |
| 119 | return ok |
| 120 | } |
searching dependent graphs…