Use JsonPrintError

This commit is contained in:
George Suntres
2026-04-14 20:46:57 -04:00
parent f79f859517
commit 80b95298f3
3 changed files with 11 additions and 19 deletions

12
seed.go
View File

@@ -28,16 +28,8 @@ func SeedStructful(files []string) error {
// 3. Unmarshal (parse) the JSON into the map
err = json.Unmarshal(content, &data)
if err != nil {
if syntaxErr, ok := err.(*json.SyntaxError); ok {
min := commons.MathMin(int64(50), syntaxErr.Offset)
from := syntaxErr.Offset - min
to := syntaxErr.Offset + min
sliceBuf := content[from:to]
log.Printf("Failed to unmarshal %#v \n %s", syntaxErr, string(sliceBuf))
}
commons.JsonPrintError(err, content)
return err
}