summaryrefslogtreecommitdiff
path: root/reencode.go
diff options
context:
space:
mode:
Diffstat (limited to 'reencode.go')
-rw-r--r--reencode.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/reencode.go b/reencode.go
index 6bd1e48..92e870a 100644
--- a/reencode.go
+++ b/reencode.go
@@ -20,8 +20,7 @@ type ReEncoder struct {
Compact bool
// String to use to indent; ignored if Compact is true.
Indent string
- // String to put before indents, for testing-compat with
- // encoding/json only.
+ // String to put before indents.
Prefix string
// Returns whether a given character in a string should be
// backslash-escaped. The bool argument is whether it was
@@ -80,9 +79,9 @@ func (enc *ReEncoder) Write(p []byte) (int, error) {
func (enc *ReEncoder) Close() error {
if enc.bufLen > 0 {
- return &SyntaxError{
+ return &DecodeSyntaxError{
Offset: enc.inputPos,
- Err: fmt.Sprintf("%v: unflushed unicode garbage: %q", io.ErrUnexpectedEOF, enc.buf[:enc.bufLen]),
+ Err: fmt.Errorf("%w: unflushed unicode garbage: %q", io.ErrUnexpectedEOF, enc.buf[:enc.bufLen]),
}
}
if _, err := enc.par.HandleEOF(); err != nil {