Skip to content

Commit

Permalink
Merge pull request #53 from boomlinde/missing-language-tag
Browse files Browse the repository at this point in the history
make the StatusError language tag optional
  • Loading branch information
davecheney committed Oct 31, 2015
2 parents a80be15 + 57048f3 commit e09e01e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ func unmarshalStatus(id uint32, data []byte) error {
}
code, data := unmarshalUint32(data)
msg, data := unmarshalString(data)
lang, _ := unmarshalString(data)
lang, _, _ := unmarshalStringSafe(data)
return &StatusError{
Code: code,
msg: msg,
Expand Down
11 changes: 11 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,14 @@ func TestFlags(t *testing.T) {
}
}
}

func TestMissingLangTag(t *testing.T) {
defer func() {
if r := recover(); r != nil {
t.Fail()
}
}()
buf := marshalUint32([]byte{}, 0)
buf = marshalStatus(buf, StatusError{})
_ = unmarshalStatus(0, buf[:len(buf)-4])
}

0 comments on commit e09e01e

Please sign in to comment.