You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-06-15 22:50:24 +02:00
pass nested error in compatible configuration
When invalid types inside a map were marshalled (in general, as soon as sorted maps have been configured), the error message has not been propagated out of the map's `subStream`. Also fix and re-enable the channel test, which now resembles the behavior of `encoding/json` and tests both default and compatible configurations. Signed-off-by: Jens Erat <email@jenserat.de>
This commit is contained in:
@ -320,6 +320,9 @@ func (encoder *sortKeysMapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
|
||||
}
|
||||
stream.Write(keyValue.keyValue)
|
||||
}
|
||||
if subStream.Error != nil && stream.Error == nil {
|
||||
stream.Error = subStream.Error
|
||||
}
|
||||
stream.WriteObjectEnd()
|
||||
stream.cfg.ReturnStream(subStream)
|
||||
stream.cfg.ReturnIterator(subIter)
|
||||
|
Reference in New Issue
Block a user