Skip to content

Commit 4b36824

Browse files
authored
fix: Don't print value with error on invalid JSON (#503)
So we don't print PII ---
1 parent dafc85b commit 4b36824

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

schema/json.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"encoding/json"
66
"errors"
7-
"fmt"
87
"reflect"
98
)
109

@@ -57,7 +56,7 @@ func (dst *JSON) Set(src interface{}) error {
5756
return nil
5857
}
5958
if !json.Valid([]byte(value)) {
60-
return fmt.Errorf("invalid json: %s", value)
59+
return errors.New("invalid JSON string value")
6160
}
6261
*dst = JSON{Bytes: []byte(value), Status: Present}
6362
case *string:
@@ -69,7 +68,7 @@ func (dst *JSON) Set(src interface{}) error {
6968
return nil
7069
}
7170
if !json.Valid([]byte(*value)) {
72-
return fmt.Errorf("invalid json: %s", *value)
71+
return errors.New("invalid JSON string pointer value")
7372
}
7473
*dst = JSON{Bytes: []byte(*value), Status: Present}
7574
}
@@ -83,7 +82,7 @@ func (dst *JSON) Set(src interface{}) error {
8382
}
8483

8584
if !json.Valid(value) {
86-
return fmt.Errorf("invalid json: %s", value)
85+
return errors.New("invalid JSON byte array value")
8786
}
8887
*dst = JSON{Bytes: value, Status: Present}
8988
}

0 commit comments

Comments
 (0)