diff options
author | Felix Lange <fjl@twurst.com> | 2017-06-23 16:50:49 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2017-06-27 19:15:12 +0800 |
commit | 4a741df757cf6b1d1b4c0e8c875c34b650f46167 (patch) | |
tree | 057d995a3847f9f983a4dcdf41cf3bc9fb9b82a2 /common/types_test.go | |
parent | b664bedcf21f30b54af542e0b4ba4e24c01968fd (diff) | |
download | go-tangerine-4a741df757cf6b1d1b4c0e8c875c34b650f46167.tar go-tangerine-4a741df757cf6b1d1b4c0e8c875c34b650f46167.tar.gz go-tangerine-4a741df757cf6b1d1b4c0e8c875c34b650f46167.tar.bz2 go-tangerine-4a741df757cf6b1d1b4c0e8c875c34b650f46167.tar.lz go-tangerine-4a741df757cf6b1d1b4c0e8c875c34b650f46167.tar.xz go-tangerine-4a741df757cf6b1d1b4c0e8c875c34b650f46167.tar.zst go-tangerine-4a741df757cf6b1d1b4c0e8c875c34b650f46167.zip |
common/hexutil: wrap errors in json.UnmarshalTypeError
This adds type and struct field context to error messages.
Instead of "hex string of odd length" users will now see "json: cannot
unmarshal hex string of odd length into Go struct field SendTxArgs.from
of type common.Address".
Diffstat (limited to 'common/types_test.go')
-rw-r--r-- | common/types_test.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/common/types_test.go b/common/types_test.go index 9f9d8b767..154c33063 100644 --- a/common/types_test.go +++ b/common/types_test.go @@ -21,8 +21,6 @@ import ( "math/big" "strings" "testing" - - "github.com/ethereum/go-ethereum/common/hexutil" ) func TestBytesConversion(t *testing.T) { @@ -43,10 +41,10 @@ func TestHashJsonValidation(t *testing.T) { Size int Error string }{ - {"", 62, hexutil.ErrMissingPrefix.Error()}, - {"0x", 66, "hex string has length 66, want 64 for Hash"}, - {"0x", 63, hexutil.ErrOddLength.Error()}, - {"0x", 0, "hex string has length 0, want 64 for Hash"}, + {"", 62, "json: cannot unmarshal hex string without 0x prefix into Go value of type common.Hash"}, + {"0x", 66, "hex string has length 66, want 64 for common.Hash"}, + {"0x", 63, "json: cannot unmarshal hex string of odd length into Go value of type common.Hash"}, + {"0x", 0, "hex string has length 0, want 64 for common.Hash"}, {"0x", 64, ""}, {"0X", 64, ""}, } |