Debian Codegraph @

v5/errors.go

raw symbols SCIP
1 package jsonpatch
2
3 import "fmt"
4
5 // AccumulatedCopySizeError is an error type returned when the accumulated size
6 // increase caused by copy operations in a patch operation has exceeded the
7 // limit.
8 type AccumulatedCopySizeError struct {
9 limit int64
10 accumulated int64
11 }
12
13 // NewAccumulatedCopySizeError returns an AccumulatedCopySizeError.
14 func NewAccumulatedCopySizeError(l, a int64) *AccumulatedCopySizeError {
15 return &AccumulatedCopySizeError{limit: l, accumulated: a}
16 }
17
18 // Error implements the error interface.
19 func (a *AccumulatedCopySizeError) Error() string {
20 return fmt.Sprintf("Unable to complete the copy, the accumulated size increase of copy is %d, exceeding the limit %d", a.accumulated, a.limit)
21 }
22
23 // ArraySizeError is an error type returned when the array size has exceeded
24 // the limit.
25 type ArraySizeError struct {
26 limit int
27 size int
28 }
29
30 // NewArraySizeError returns an ArraySizeError.
31 func NewArraySizeError(l, s int) *ArraySizeError {
32 return &ArraySizeError{limit: l, size: s}
33 }
34
35 // Error implements the error interface.
36 func (a *ArraySizeError) Error() string {
37 return fmt.Sprintf("Unable to create array of size %d, limit is %d", a.size, a.limit)
38 }