-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
81 lines (74 loc) · 3.42 KB
/
Copy patherrors.go
File metadata and controls
81 lines (74 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package rule
type EngineError struct {
Code string
Message string
}
func (e *EngineError) Error() string {
return e.Message
}
var (
ErrInvalidNode = &EngineError{"INVALID_NODE", "Invalid AST node type"}
ErrInvalidLiteral = &EngineError{"INVALID_LITERAL", "Invalid literal value"}
ErrInvalidOperator = &EngineError{"INVALID_OPERATOR", "Invalid operator"}
ErrAttributeNotFound = &EngineError{
"ATTRIBUTE_NOT_FOUND",
"Attribute not found in context",
}
ErrInvalidNestedAttribute = &EngineError{
"INVALID_NESTED_ATTRIBUTE",
"Invalid nested attribute access",
}
ErrParseError = &EngineError{"PARSE_ERROR", "Failed to parse rule"}
ErrEvaluationError = &EngineError{"EVALUATION_ERROR", "Failed to evaluate rule"}
ErrRuleNotFound = &EngineError{"RULE_NOT_FOUND", "Rule not found - use AddQuery to pre-compile rule"}
// ErrUnterminatedString indicates an unterminated string literal in the query.
ErrUnterminatedString = &EngineError{"UNTERMINATED_STRING", "Unterminated string literal"}
// ErrMissingOperator indicates missing operator between operands.
ErrMissingOperator = &EngineError{"MISSING_OPERATOR", "Missing operator between operands"}
// ErrInvalidSyntax indicates invalid query syntax.
ErrInvalidSyntax = &EngineError{"INVALID_SYNTAX", "Invalid query syntax"}
// ErrInvalidInOperand indicates IN operator used with non-array operand.
ErrInvalidInOperand = &EngineError{"INVALID_IN_OPERAND", "IN operator requires an array operand"}
ErrInvalidStringOp = &EngineError{
"INVALID_STRING_OP",
"String operators (co/sw/ew) can only be used with string operands",
}
ErrInvalidPresenceOp = &EngineError{
"INVALID_PRESENCE_OP",
"Presence operator (pr) can only be used with identifiers or properties",
}
ErrEmptyQuery = &EngineError{"EMPTY_QUERY", "Query cannot be empty"}
ErrEmptyParentheses = &EngineError{"EMPTY_PARENTHESES", "Empty parentheses are not allowed"}
ErrUnbalancedParens = &EngineError{"UNBALANCED_PARENTHESES", "Unbalanced parentheses"}
ErrTrailingTokens = &EngineError{"TRAILING_TOKENS", "Unexpected tokens after complete expression"}
// ErrQuantifierRequiresParens indicates a quantifier operator used without parenthesized sub-expression.
ErrQuantifierRequiresParens = &EngineError{
"QUANTIFIER_REQUIRES_PARENS",
"Quantifier operators (any/all/none) require a parenthesized sub-expression",
}
// ErrInvalidQuantifierTarget indicates a quantifier used on a non-identifier/property operand.
ErrInvalidQuantifierTarget = &EngineError{
"INVALID_QUANTIFIER_TARGET",
"Quantifier operators (any/all/none) can only be used with identifiers or properties",
}
// ErrWhereRequiresParens indicates where used without parenthesized predicate.
ErrWhereRequiresParens = &EngineError{
"WHERE_REQUIRES_PARENS",
"where operator requires a parenthesized predicate",
}
// ErrWhereRequiresLengthOrQuantifier indicates where without .length or quantifier after.
ErrWhereRequiresLengthOrQuantifier = &EngineError{
"WHERE_REQUIRES_LENGTH_OR_QUANTIFIER",
"where expression must be followed by .length or a quantifier (any/all/none)",
}
// ErrEmptyWherePredicate indicates where with empty predicate.
ErrEmptyWherePredicate = &EngineError{
"EMPTY_WHERE_PREDICATE",
"where predicate cannot be empty",
}
// ErrWhereRequiresLength indicates where followed by non-length property.
ErrWhereRequiresLength = &EngineError{
"WHERE_REQUIRES_LENGTH",
"where can only be followed by .length",
}
)