Update accounts/abi/error.go

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
This commit is contained in:
levisyin 2023-11-15 21:15:23 +08:00 committed by GitHub
parent 6f9663653a
commit f549c17e32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,7 +84,7 @@ func (e Error) String() string {
func (e *Error) Unpack(data []byte) (interface{}, error) { func (e *Error) Unpack(data []byte) (interface{}, error) {
if len(data) < 4 { if len(data) < 4 {
return "", errors.New("invalid data for unpacking, length is less than 4") return "", fmt.Errorf("invalid data length for unpacking: got %v, want 4", len(data))
} }
if !bytes.Equal(data[:4], e.ID[:4]) { if !bytes.Equal(data[:4], e.ID[:4]) {
return "", errors.New("invalid data for unpacking, first four bytes are not equal with error's signature") return "", errors.New("invalid data for unpacking, first four bytes are not equal with error's signature")