Make ErrHashStrSize slightly more descriptive.

Add the word 'string' to the error string so if this is printed, it
will be clearer that it was a hash string decode that failed (as
opposed to other errors creating a ShaHash from a byte slice) and
change 'chars' to 'bytes', since the string length is measured in
bytes, not UTF-8 code points.

ok @davecgh
This commit is contained in:
Josh Rickmar 2014-09-12 08:38:59 -05:00
parent 225248d283
commit 0127b3aafe

View file

@ -18,7 +18,7 @@ const MaxHashStringSize = HashSize * 2
// ErrHashStrSize describes an error that indicates the caller specified a hash // ErrHashStrSize describes an error that indicates the caller specified a hash
// string that has too many characters. // string that has too many characters.
var ErrHashStrSize = fmt.Errorf("max hash length is %v chars", MaxHashStringSize) var ErrHashStrSize = fmt.Errorf("max hash string length is %v bytes", MaxHashStringSize)
// ShaHash is used in several of the bitcoin messages and common structures. It // ShaHash is used in several of the bitcoin messages and common structures. It
// typically represents the double sha256 of data. // typically represents the double sha256 of data.