@@ -3,9 +3,9 @@ package hex
33import (
44 "encoding/hex"
55 "encoding/json"
6+ "errors"
7+ "fmt"
68 "reflect"
7-
8- "github.com/pkg/errors"
99)
1010
1111// Similar to go-ethereum's hexutil.Bytes but does not assume a 0x prefix.
@@ -31,7 +31,7 @@ func (b *PlainHexBytes) UnmarshalJSON(input []byte) (err error) {
3131 return & json.UnmarshalTypeError {Value : "non-string" , Type : reflect .TypeOf ((PlainHexBytes )(nil ))}
3232 }
3333 err = b .UnmarshalText (input [1 : len (input )- 1 ])
34- return errors . Wrap ( err , "UnmarshalJSON failed" )
34+ return fmt . Errorf ( "UnmarshalJSON failed: %w" , err )
3535}
3636
3737func isString (input []byte ) bool {
@@ -42,11 +42,11 @@ func isString(input []byte) bool {
4242func (b * PlainHexBytes ) UnmarshalText (input []byte ) error {
4343 raw , err := checkText (input , true )
4444 if err != nil {
45- return errors . Wrap ( err , "UnmarshalText failed" )
45+ return fmt . Errorf ( "UnmarshalText failed: %w" , err )
4646 }
4747 dec := make ([]byte , len (raw )/ 2 )
4848 if _ , err = hex .Decode (dec , raw ); err != nil {
49- return errors . Wrap ( err , "UnmarshalText failed" )
49+ return fmt . Errorf ( "UnmarshalText failed: %w" , err )
5050 }
5151 * b = dec
5252 return nil
0 commit comments