aboutsummaryrefslogtreecommitdiff
path: root/src/os/exec/exec.go
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2019-03-27 08:40:12 -0700
committerDamien Neil <dneil@google.com>2019-05-04 16:14:12 +0000
commit170b8b4b12be50eeccbcdadb8523fb4fc670ca72 (patch)
treef379b48b3e9fd304aef9140983b1a2d2ecbe60fa /src/os/exec/exec.go
parent59ea685ce96a696281e56badd80d2e5dd618b0b0 (diff)
downloadgo-170b8b4b12be50eeccbcdadb8523fb4fc670ca72.tar.gz
go-170b8b4b12be50eeccbcdadb8523fb4fc670ca72.zip
all: add Unwrap and Is methods to various error types
Add Unwrap methods to types which wrap an underlying error: "encodinc/csv".ParseError "encoding/json".MarshalerError "net/http".transportReadFromServerError "net".OpError "net".DNSConfigError "net/url".Error "os/exec".Error "signal/internal/pty".PtyError "text/template".ExecError Add os.ErrTemporary. A case could be made for putting this error value in package net, since no exported error types in package os include a Temporary method. However, syscall errors returned from the os package do include this method. Add Is methods to error types with a Timeout or Temporary method, making errors.Is(err, os.Err{Timeout,Temporary}) equivalent to testing the corresponding method: "context".DeadlineExceeded "internal/poll".TimeoutError "net".adrinfoErrno "net".OpError "net".DNSError "net/http".httpError "net/http".tlsHandshakeTimeoutError "net/pipe".timeoutError "net/url".Error Updates #30322 Updates #29934 Change-Id: I409fb20c072ea39116ebfb8c7534d493483870dc Reviewed-on: https://go-review.googlesource.com/c/go/+/170037 Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
Diffstat (limited to 'src/os/exec/exec.go')
-rw-r--r--src/os/exec/exec.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/os/exec/exec.go b/src/os/exec/exec.go
index 9a9265b667..17ef003eca 100644
--- a/src/os/exec/exec.go
+++ b/src/os/exec/exec.go
@@ -47,6 +47,8 @@ func (e *Error) Error() string {
return "exec: " + strconv.Quote(e.Name) + ": " + e.Err.Error()
}
+func (e *Error) Unwrap() error { return e.Err }
+
// Cmd represents an external command being prepared or run.
//
// A Cmd cannot be reused after calling its Run, Output or CombinedOutput