diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-10 21:56:11 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-10 21:56:11 -0700 |
commit | d7414035894f378c9e1d48b04a767f61b082186a (patch) | |
tree | ba9ec20307b4200f1010bc291d78c3786b57e326 /encode.go | |
parent | c604347f1950e3dfbef2f524da8a63692848da27 (diff) | |
parent | 276ab5935873edc05e1882c06fc527a14babd27c (diff) |
Merge branch 'lukeshu/reencode-io'
Diffstat (limited to 'encode.go')
-rw-r--r-- | encode.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -83,6 +83,12 @@ func (enc *Encoder) Encode(obj any) (err error) { enc.w.par.Reset() } if err := encode(enc.w, reflect.ValueOf(obj), enc.w.BackslashEscape, false, 0, map[any]struct{}{}); err != nil { + if rwe, ok := err.(*ReEncodeWriteError); ok { + err = &EncodeWriteError{ + Err: rwe.Err, + Offset: rwe.Offset, + } + } return err } if enc.isRoot { |