Fixes build error: undefined: os.IsTimeout

Signed-off-by: Christian Stewart <christian@paral.in>
Этот коммит содержится в:
Christian Stewart 2023-03-03 22:59:59 -08:00 коммит произвёл Ron Evans
родитель 57ecf1acdc
коммит 930255ff46

Просмотреть файл

@ -92,6 +92,11 @@ func IsPermission(err error) bool {
return underlyingErrorIs(err, ErrPermission) return underlyingErrorIs(err, ErrPermission)
} }
func IsTimeout(err error) bool {
terr, ok := underlyingError(err).(timeout)
return ok && terr.Timeout()
}
func underlyingErrorIs(err, target error) bool { func underlyingErrorIs(err, target error) bool {
// Note that this function is not errors.Is: // Note that this function is not errors.Is:
// underlyingError only unwraps the specific error-wrapping types // underlyingError only unwraps the specific error-wrapping types