Skip to content

Commit

Permalink
improved error message
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 committed Aug 26, 2017
1 parent 9570161 commit f3e0a30
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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'.
Expand Down

0 comments on commit f3e0a30

Please sign in to comment.