From 21c27ffa1b5db9b3746a46ba82c9cecf54e6558c Mon Sep 17 00:00:00 2001 From: Josh Leverette Date: Thu, 9 May 2019 15:53:24 -0700 Subject: [PATCH] improve codec error strings --- codec.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/codec.go b/codec.go index e3d8cfb..e3014c6 100644 --- a/codec.go +++ b/codec.go @@ -114,7 +114,7 @@ func (u *UUID) UnmarshalText(text []byte) error { case 41, 45: return u.decodeURN(text) default: - return fmt.Errorf("uuid: incorrect UUID length: %s", text) + return fmt.Errorf("uuid: incorrect UUID length %d in string %q", len(text), text) } } @@ -122,7 +122,7 @@ func (u *UUID) UnmarshalText(text []byte) error { // "6ba7b810-9dad-11d1-80b4-00c04fd430c8". func (u *UUID) decodeCanonical(t []byte) error { if t[8] != '-' || t[13] != '-' || t[18] != '-' || t[23] != '-' { - return fmt.Errorf("uuid: incorrect UUID format %s", t) + return fmt.Errorf("uuid: incorrect UUID format in string %q", t) } src := t @@ -160,7 +160,7 @@ func (u *UUID) decodeBraced(t []byte) error { l := len(t) if t[0] != '{' || t[l-1] != '}' { - return fmt.Errorf("uuid: incorrect UUID format %s", t) + return fmt.Errorf("uuid: incorrect UUID format in string %q", t) } return u.decodePlain(t[1 : l-1]) @@ -175,7 +175,7 @@ func (u *UUID) decodeURN(t []byte) error { urnUUIDPrefix := t[:9] if !bytes.Equal(urnUUIDPrefix, urnPrefix) { - return fmt.Errorf("uuid: incorrect UUID format: %s", t) + return fmt.Errorf("uuid: incorrect UUID format in string %q", t) } return u.decodePlain(t[9:total]) @@ -191,7 +191,7 @@ func (u *UUID) decodePlain(t []byte) error { case 36: return u.decodeCanonical(t) default: - return fmt.Errorf("uuid: incorrect UUID length: %s", t) + return fmt.Errorf("uuid: incorrect UUID length %d in string %q", len(t), t) } }