aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/csv
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/encoding/csv
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/encoding/csv')
-rw-r--r--src/encoding/csv/reader.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/encoding/csv/reader.go b/src/encoding/csv/reader.go
index a2fd4c0970..c40aa506b0 100644
--- a/src/encoding/csv/reader.go
+++ b/src/encoding/csv/reader.go
@@ -80,6 +80,8 @@ func (e *ParseError) Error() string {
return fmt.Sprintf("parse error on line %d, column %d: %v", e.Line, e.Column, e.Err)
}
+func (e *ParseError) Unwrap() error { return e.Err }
+
// These are the errors that can be returned in ParseError.Err.
var (
ErrTrailingComma = errors.New("extra delimiter at end of line") // Deprecated: No longer used.