1
0
mirror of https://github.com/golang/go synced 2024-11-20 03:54:40 -07:00

gob: bug fix: errors encoding the payload were not

returned to caller.

R=rsc
CC=golang-dev
https://golang.org/cl/1164041
This commit is contained in:
Rob Pike 2010-05-07 13:30:13 -07:00
parent 56c5710b38
commit b541921b66

View File

@ -173,8 +173,12 @@ func (enc *Encoder) Encode(e interface{}) os.Error {
encodeInt(enc.state, int64(enc.sent[rt]))
// Encode the object.
encode(enc.state.b, e)
enc.send()
err := encode(enc.state.b, e)
if err != nil {
enc.setError(err)
} else {
enc.send()
}
return enc.state.err
}