This commit is contained in:
bluepython508 committed 2026-10-22 12:27:19 +01:00
1 parent 3530afb854
commit 6903fcff27
2146 files changed
+112256 -190703

No files matched your search

+13 -5
View File
@@ -770,8 +770,11 @@ func (es *encodeState) Save(obj reflect.Value) {
es.encodeObject(oes.obj, oes.how, &oes.encoded)
}
}); err != nil {
// Include the object in the error message.
Failf("encoding error: %w\nfor object %#v", err, oes.obj.Interface())
// Include the object in the error message, if available.
if oes != nil && oes.obj.IsValid() {
Failf("encoding error: %w\nfor object %#v", err, oes.obj.Interface())
}
Failf("encoding error: %w", err)
}
// Check that we have objects to serialize.
@@ -802,14 +805,19 @@ func (es *encodeState) Save(obj reflect.Value) {
})
for _, id := range ids {
// Encode the id.
oes = nil
wire.Save(&es.w, wire.Uint(id))
// Marshal the object.
oes := es.pending[id]
oes = es.pending[id]
wire.Save(&es.w, oes.encoded)
}
}); err != nil {
// Include the object and the error.
Failf("error serializing object %#v: %w", oes.encoded, err)
if oes != nil {
// Include the object and the error.
Failf("error serializing object %#v: %w", oes.encoded, err)
} else {
Failf("error serializing type or ID: %w", err)
}
}
}