os: add IsTimeout function
Fixes build error: undefined: os.IsTimeout Signed-off-by: Christian Stewart <christian@paral.in>
Этот коммит содержится в:
родитель
57ecf1acdc
коммит
930255ff46
1 изменённых файлов: 5 добавлений и 0 удалений
|
@ -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
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче