@@ -4,38 +4,40 @@ import "errors"
44
55// Sentinel errors for path and validation related operations
66var (
7- // Core path errors - aligned with json-joy patterns
8- ErrPathNotFound = errors .New ("NOT_FOUND " )
9- ErrPathDoesNotExist = errors .New ("NOT_FOUND " )
10- ErrInvalidPath = errors .New ("OP_PATH_INVALID " )
11- ErrPathEmpty = errors .New ("OP_PATH_INVALID " )
12- ErrFromPathEmpty = errors .New ("OP_FROM_INVALID " )
7+ // Core path errors
8+ ErrPathNotFound = errors .New ("path not found " )
9+ ErrPathDoesNotExist = errors .New ("path does not exist " )
10+ ErrInvalidPath = errors .New ("invalid path " )
11+ ErrPathEmpty = errors .New ("path cannot be empty " )
12+ ErrFromPathEmpty = errors .New ("from path cannot be empty " )
1313 ErrPathsIdentical = errors .New ("cannot move into own children" )
1414
15- // Array operation errors - aligned with json-joy patterns
16- ErrArrayIndexOutOfBounds = errors .New ("INVALID_INDEX " )
17- ErrIndexOutOfRange = errors .New ("INVALID_INDEX " )
18- ErrNotAnArray = errors .New ("Not a array" )
15+ // Array operation errors
16+ ErrArrayIndexOutOfBounds = errors .New ("array index out of bounds " )
17+ ErrIndexOutOfRange = errors .New ("index out of range " )
18+ ErrNotAnArray = errors .New ("not an array" )
1919 ErrArrayTooSmall = errors .New ("array must have at least 2 elements" )
20- ErrPositionOutOfBounds = errors .New ("INVALID_INDEX" )
21- ErrPositionNegative = errors .New ("INVALID_INDEX" )
20+ ErrPositionOutOfBounds = errors .New ("position out of bounds" )
21+ ErrPositionNegative = errors .New ("position cannot be negative" )
22+ ErrInvalidTarget = errors .New ("invalid target" )
2223
23- // Type validation errors - aligned with json-joy patterns
24- ErrNotString = errors .New ("value is not a string" )
25- ErrNotNumber = errors .New ("value must be a number" )
26- ErrNotObject = errors .New ("value is not an object" )
27- ErrInvalidType = errors .New ("invalid type" )
28- ErrEmptyTypeList = errors .New ("empty type list" )
24+ // Type validation errors
25+ ErrNotString = errors .New ("value is not a string" )
26+ ErrNotNumber = errors .New ("value must be a number" )
27+ ErrNotObject = errors .New ("value is not an object" )
28+ ErrInvalidType = errors .New ("invalid type" )
29+ ErrEmptyTypeList = errors .New ("empty type list" )
30+ ErrContainsValueMustBeString = errors .New ("contains operation value must be a string" )
2931
30- // Operation execution errors - aligned with json-joy patterns
32+ // Operation execution errors
3133 ErrTestFailed = errors .New ("test failed" )
3234 ErrDefinedTestFailed = errors .New ("defined test failed" )
3335 ErrUndefinedTestFailed = errors .New ("undefined test failed" )
3436 ErrAndTestFailed = errors .New ("and test failed" )
3537 ErrOrTestFailed = errors .New ("or test failed" )
3638 ErrNotTestFailed = errors .New ("not test failed" )
3739
38- // Value operation errors - aligned with json-joy patterns
40+ // Value operation errors
3941 ErrCannotReplace = errors .New ("NOT_FOUND" )
4042 ErrCannotAddToValue = errors .New ("cannot add to non-object/non-array value" )
4143 ErrCannotRemoveFromValue = errors .New ("cannot remove from non-object/non-array document" )
@@ -49,24 +51,25 @@ var (
4951 ErrInvalidKeyTypeSlice = errors .New ("invalid key type for slice" )
5052 ErrUnsupportedParentType = errors .New ("unsupported parent type" )
5153
52- // String operation errors - aligned with json-joy patterns
53- ErrPositionOutOfStringRange = errors .New ("INVALID_INDEX " )
54+ // String operation errors
55+ ErrPositionOutOfStringRange = errors .New ("position out of string range " )
5456 ErrSubstringTooLong = errors .New ("value too long" )
5557 ErrSubstringMismatch = errors .New ("substring does not match" )
5658 ErrStringLengthMismatch = errors .New ("string length mismatch" )
5759 ErrPatternEmpty = errors .New ("pattern cannot be empty" )
58- ErrLengthNegative = errors .New ("INVALID_INDEX " )
60+ ErrLengthNegative = errors .New ("length cannot be negative " )
5961
6062 // Type comparison errors
61- ErrTypeMismatch = errors .New ("type mismatch" )
63+ ErrTypeMismatch = errors .New ("type mismatch" )
64+ ErrContainsMismatch = errors .New ("contains check failed" )
6265
63- // Predicate operation errors - aligned with json-joy patterns
64- ErrInvalidPredicateInAnd = errors .New ("OP_INVALID " )
65- ErrInvalidPredicateInNot = errors .New ("OP_INVALID " )
66- ErrInvalidPredicateInOr = errors .New ("OP_INVALID " )
67- ErrAndNoOperands = errors .New ("empty operation patch " )
68- ErrNotNoOperands = errors .New ("empty operation patch " )
69- ErrOrNoOperands = errors .New ("empty operation patch " )
66+ // Predicate operation errors
67+ ErrInvalidPredicateInAnd = errors .New ("invalid predicate in and operation " )
68+ ErrInvalidPredicateInNot = errors .New ("invalid predicate in not operation " )
69+ ErrInvalidPredicateInOr = errors .New ("invalid predicate in or operation " )
70+ ErrAndNoOperands = errors .New ("and operation requires at least one operand " )
71+ ErrNotNoOperands = errors .New ("not operation requires operands " )
72+ ErrOrNoOperands = errors .New ("or operation requires at least one operand " )
7073
7174 // Operation modification errors
7275 ErrCannotModifyRootArray = errors .New ("cannot modify root array directly" )
8083 ErrCannotConvertNilToString = errors .New ("cannot convert nil to string" )
8184
8285 // Test operation errors
83- ErrTestOperationNumberStringMismatch = errors .New ("test operation failed: number is not equal to string" )
84- ErrTestOperationStringNotEquivalent = errors .New ("test operation failed: string not equivalent" )
86+ ErrTestOperationNumberStringMismatch = errors .New ("number is not equal to string" )
87+ ErrTestOperationStringNotEquivalent = errors .New ("string not equivalent" )
8588
8689 // Base errors for dynamic wrapping with fmt.Errorf
8790 ErrComparisonFailed = errors .New ("comparison failed" )
0 commit comments