diff options
author | Cherry Zhang <cherryyz@google.com> | 2020-10-28 09:12:20 -0400 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2020-10-28 09:12:20 -0400 |
commit | a16e30d162c1c7408db7821e7b9513cefa09c6ca (patch) | |
tree | af752ba9ba44c547df39bb0af9bff79f610ba9d5 /src/os/error.go | |
parent | 91e4d2d57bc341dd82c98247117114c851380aef (diff) | |
parent | cf6cfba4d5358404dd890f6025e573a4b2156543 (diff) | |
download | go-git-dev.link.tar.gz |
[dev.link] all: merge branch 'master' into dev.linkdev.link
Clean merge.
Change-Id: Ia7b2808bc649790198d34c226a61d9e569084dc5
Diffstat (limited to 'src/os/error.go')
-rw-r--r-- | src/os/error.go | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/src/os/error.go b/src/os/error.go index 875cc9711f..7cd9f22bfb 100644 --- a/src/os/error.go +++ b/src/os/error.go @@ -7,6 +7,7 @@ package os import ( "internal/oserror" "internal/poll" + "io/fs" ) // Portable analogs of some common system call errors. @@ -16,20 +17,17 @@ import ( var ( // ErrInvalid indicates an invalid argument. // Methods on File will return this error when the receiver is nil. - ErrInvalid = errInvalid() // "invalid argument" + ErrInvalid = fs.ErrInvalid // "invalid argument" + + ErrPermission = fs.ErrPermission // "permission denied" + ErrExist = fs.ErrExist // "file already exists" + ErrNotExist = fs.ErrNotExist // "file does not exist" + ErrClosed = fs.ErrClosed // "file already closed" - ErrPermission = errPermission() // "permission denied" - ErrExist = errExist() // "file already exists" - ErrNotExist = errNotExist() // "file does not exist" - ErrClosed = errClosed() // "file already closed" ErrNoDeadline = errNoDeadline() // "file type does not support deadline" ErrDeadlineExceeded = errDeadlineExceeded() // "i/o timeout" ) -func errInvalid() error { return oserror.ErrInvalid } -func errPermission() error { return oserror.ErrPermission } -func errExist() error { return oserror.ErrExist } -func errNotExist() error { return oserror.ErrNotExist } func errClosed() error { return oserror.ErrClosed } func errNoDeadline() error { return poll.ErrNoDeadline } @@ -47,21 +45,7 @@ type timeout interface { } // PathError records an error and the operation and file path that caused it. -type PathError struct { - Op string - Path string - Err error -} - -func (e *PathError) Error() string { return e.Op + " " + e.Path + ": " + e.Err.Error() } - -func (e *PathError) Unwrap() error { return e.Err } - -// Timeout reports whether this error represents a timeout. -func (e *PathError) Timeout() bool { - t, ok := e.Err.(timeout) - return ok && t.Timeout() -} +type PathError = fs.PathError // SyscallError records an error from a specific system call. type SyscallError struct { |