mirror of
https://github.com/golang/go.git
synced 2025-11-11 22:21:06 +00:00
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>
This commit is contained in:
parent
a408139bb0
commit
114719e16e
4 changed files with 1 additions and 84 deletions
|
|
@ -245,12 +245,6 @@ func (e *UnsupportedValueError) Error() string {
|
|||
return "json: unsupported value: " + e.Str
|
||||
}
|
||||
|
||||
// Is returns true if target is a UnsupportedValueError.
|
||||
func (e *UnsupportedValueError) Is(target error) bool {
|
||||
_, ok := target.(*UnsupportedValueError)
|
||||
return ok
|
||||
}
|
||||
|
||||
// Before Go 1.2, an InvalidUTF8Error was returned by Marshal when
|
||||
// attempting to encode a string value with invalid UTF-8 sequences.
|
||||
// As of Go 1.2, Marshal instead coerces the string to valid UTF-8 by
|
||||
|
|
@ -285,12 +279,6 @@ func (e *MarshalerError) Error() string {
|
|||
// Unwrap returns the underlying error.
|
||||
func (e *MarshalerError) Unwrap() error { return e.Err }
|
||||
|
||||
// Is returns true if target is a MarshalerError.
|
||||
func (e *MarshalerError) Is(target error) bool {
|
||||
_, ok := target.(*MarshalerError)
|
||||
return ok
|
||||
}
|
||||
|
||||
var hex = "0123456789abcdef"
|
||||
|
||||
// An encodeState encodes JSON into a bytes.Buffer.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue