[skip ci]Improve error messages in convension (#10352)

Signed-off-by: Xiangyu Wang <xiangyu.wang@zilliz.com>
This commit is contained in:
Xiangyu Wang 2021-10-21 19:40:35 +08:00 committed by GitHub
parent 81743d9642
commit bbd558f509
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,7 +37,7 @@ func BytesToFloat32(bytes []byte) float32 {
// BytesToInt64 converts a byte slice to uint64.
func BytesToInt64(b []byte) (int64, error) {
if len(b) != 8 {
return 0, fmt.Errorf("invalid data, must 8 bytes, but %d", len(b))
return 0, fmt.Errorf("Failed to convert []byte to int64: invalid data, must 8 bytes, but %d", len(b))
}
return int64(binary.BigEndian.Uint64(b)), nil
@ -53,7 +53,7 @@ func Int64ToBytes(v int64) []byte {
// BytesToUint64 converts a byte slice to uint64.
func BytesToUint64(b []byte) (uint64, error) {
if len(b) != 8 {
return 0, fmt.Errorf("invalid data, must 8 bytes, but %d", len(b))
return 0, fmt.Errorf("Failed to convert []byte to uint64: invalid data, must 8 bytes, but %d", len(b))
}
return binary.BigEndian.Uint64(b), nil