Error handling, testing

This commit is contained in:
Jakob Borg
2013-12-20 00:01:34 +01:00
parent eba1c9e649
commit f5987fba32
6 changed files with 207 additions and 35 deletions

View File

@@ -35,8 +35,8 @@ func (w *marshalWriter) writeBytes(bs []byte) {
return
}
_, w.err = w.w.Write(bs)
if p := pad(len(bs)); p > 0 {
w.w.Write(padBytes[:p])
if p := pad(len(bs)); w.err == nil && p > 0 {
_, w.err = w.w.Write(padBytes[:p])
}
w.tot += len(bs) + pad(len(bs))
}