diff options
| author | Damien Neil <dneil@google.com> | 2020-09-14 21:00:52 +0000 |
|---|---|---|
| committer | Damien Neil <dneil@google.com> | 2020-09-14 21:33:20 +0000 |
| commit | 114719e16e9681bd1001326598ededa719c17944 (patch) | |
| tree | 0773ea1d3d97233585db743c95c5f76247d60969 /src/encoding/json/decode.go | |
| parent | a408139bb0166f6e0a5d9fd17fc934da960c354e (diff) | |
| download | go-114719e16e9681bd1001326598ededa719c17944.tar.xz | |
Revert "encoding/json: implement Is on all errors"
This reverts CL 254537.
Reason for revert: Reason for revert: The recommended way to check for a type of error is errors.As. API changes should also start with a proposal.
Change-Id: I07c37428575e99c80b17525833a61831d10963bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/254857
Trust: Damien Neil <dneil@google.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Diffstat (limited to 'src/encoding/json/decode.go')
| -rw-r--r-- | src/encoding/json/decode.go | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/src/encoding/json/decode.go b/src/encoding/json/decode.go index 1b006ffb17..86d8a69db7 100644 --- a/src/encoding/json/decode.go +++ b/src/encoding/json/decode.go @@ -136,12 +136,6 @@ func (e *UnmarshalTypeError) Error() string { return "json: cannot unmarshal " + e.Value + " into Go value of type " + e.Type.String() } -// Is returns true if target is a UnmarshalTypeError. -func (e *UnmarshalTypeError) Is(target error) bool { - _, ok := target.(*UnmarshalTypeError) - return ok -} - // An UnmarshalFieldError describes a JSON object key that // led to an unexported (and therefore unwritable) struct field. // @@ -156,24 +150,12 @@ func (e *UnmarshalFieldError) Error() string { return "json: cannot unmarshal object key " + strconv.Quote(e.Key) + " into unexported field " + e.Field.Name + " of type " + e.Type.String() } -// Is returns true if target is a UnmarshalFieldError. -func (e *UnmarshalFieldError) Is(target error) bool { - _, ok := target.(*UnmarshalFieldError) - return ok -} - // An InvalidUnmarshalError describes an invalid argument passed to Unmarshal. // (The argument to Unmarshal must be a non-nil pointer.) type InvalidUnmarshalError struct { Type reflect.Type } -// Is returns true if target is a InvalidUnmarshalError. -func (e *InvalidUnmarshalError) Is(target error) bool { - _, ok := target.(*InvalidUnmarshalError) - return ok -} - func (e *InvalidUnmarshalError) Error() string { if e.Type == nil { return "json: Unmarshal(nil)" |
