summaryrefslogtreecommitdiff
path: root/errors.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@datawire.io>2022-08-15 19:49:46 -0600
committerLuke Shumaker <lukeshu@datawire.io>2022-08-16 00:05:35 -0600
commit6476b9ae7019bedd9324786ff47bc25693e01b60 (patch)
tree3d793bbd40327d20ba7021459862c895cddb5fb2 /errors.go
parent54bbd1e59317a6e9658eb8098657078cc8e81979 (diff)
Push nesting-depth checks down in to the parser [ci-skip]
Diffstat (limited to 'errors.go')
-rw-r--r--errors.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/errors.go b/errors.go
index a5a4080..cee82f7 100644
--- a/errors.go
+++ b/errors.go
@@ -6,10 +6,21 @@ package lowmemjson
import (
"encoding/json"
+ "errors"
"fmt"
"reflect"
"strings"
- "errors"
+)
+
+// parser errors ///////////////////////////////////////////////////////////////////////////////////
+
+type ParseError struct {
+ Err error
+ Offset int64
+}
+
+var (
+ ErrParserExceededMaxDepth = errors.New("exceeded max depth")
)
// low-level decode errors /////////////////////////////////////////////////////////////////////////
@@ -65,8 +76,6 @@ func (e *DecodeTypeError) Error() string {
func (e *DecodeTypeError) Unwrap() error { return e.Err }
-var ErrDecodeExceededMaxDepth = errors.New("exceeded max depth")
-
// high-level decode errors ////////////////////////////////////////////////////////////////////////
// A *DecodeArgumentError is returned from Decode if the argument is