From f3e0a30357713959c31a070cfea89c818d58476b Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Sat, 26 Aug 2017 07:56:44 -0500 Subject: [PATCH] improved error message --- encode.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/encode.go b/encode.go index c10ba6b..e5e793f 100644 --- a/encode.go +++ b/encode.go @@ -102,7 +102,8 @@ func (e *Encoder) EncodeInt64(v int64) error { // EncodeInt encodes an int in the smallest possible integer format (U,i,L,l,L). func (e *Encoder) EncodeInt(v int) error { - switch smallestIntMarker(int64(v)) { + m := smallestIntMarker(int64(v)) + switch m { case UInt8Marker: return e.EncodeUInt8(uint8(v)) case Int8Marker: @@ -113,8 +114,9 @@ func (e *Encoder) EncodeInt(v int) error { return e.EncodeInt32(int32(v)) case Int64Marker: return e.EncodeInt64(int64(v)) + default: + return errors.Errorf("unsupported marker: %s", string(m)) } - return errors.New("TODO unreachable, programmere marker error") } // EncodeFloat32 encodes a float32 as an 'f'.