mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 10:37:46 +00:00
os: add IsTimeout function
Fixes build error: undefined: os.IsTimeout Signed-off-by: Christian Stewart <christian@paral.in>
This commit is contained in:
committed by
Ron Evans
parent
57ecf1acdc
commit
930255ff46
@@ -92,6 +92,11 @@ func IsPermission(err error) bool {
|
||||
return underlyingErrorIs(err, ErrPermission)
|
||||
}
|
||||
|
||||
func IsTimeout(err error) bool {
|
||||
terr, ok := underlyingError(err).(timeout)
|
||||
return ok && terr.Timeout()
|
||||
}
|
||||
|
||||
func underlyingErrorIs(err, target error) bool {
|
||||
// Note that this function is not errors.Is:
|
||||
// underlyingError only unwraps the specific error-wrapping types
|
||||
|
||||
Reference in New Issue
Block a user