diff --git a/ast/error.go b/ast/error.go index 00a04468e..73b7af0b8 100644 --- a/ast/error.go +++ b/ast/error.go @@ -79,7 +79,7 @@ func (self SyntaxError) description() string { /* check for empty source */ if self.Src == "" { - return fmt.Sprintf("no sources available: %#v", self) + return fmt.Sprintf("no sources available, the input json is empty: %#v", self) } /* prevent slicing before the beginning */ diff --git a/internal/decoder/errors/errors.go b/internal/decoder/errors/errors.go index ae59ce169..9f05e8b6a 100644 --- a/internal/decoder/errors/errors.go +++ b/internal/decoder/errors/errors.go @@ -46,7 +46,7 @@ func (self SyntaxError) Description() string { func (self SyntaxError) description() string { /* check for empty source */ if self.Src == "" { - return fmt.Sprintf("no sources available: %#v", self) + return fmt.Sprintf("no sources available, the input json is empty: %#v", self) } p, x, q, y := calcBounds(len(self.Src), self.Pos) diff --git a/internal/encoder/vars/errors.go b/internal/encoder/vars/errors.go index 2e7622421..77919c44a 100644 --- a/internal/encoder/vars/errors.go +++ b/internal/encoder/vars/errors.go @@ -58,7 +58,7 @@ const ( func GoPanic(code int, val unsafe.Pointer) { switch(code){ case PanicNilPointerOfNonEmptyString: - panic(fmt.Sprintf("val: %#v has nil pointer while its length is not zero!", (*rt.GoString)(val))) + panic(fmt.Sprintf("val: %#v has nil pointer while its length is not zero!\nThis is a nil pointer exception (NPE) problem. There might be a data race issue. It is recommended to execute the tests related to the code with the `-race` compile flag to detect the problem.", (*rt.GoString)(val))) default: panic("encoder error!") }