-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcypher_error.go
63 lines (53 loc) · 1.39 KB
/
cypher_error.go
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
package cypher
import "fmt"
const (
VariableAlreadyBound = "VariableAlreadyBound"
UndefinedVariable = "UndefinedVariable"
NoSingleRelationshipType = "NoSingleRelationshipType"
RequiresDirectedRelationship = "RequiresDirectedRelationship"
CreatingVarLength = "CreatingVarLength"
InvalidParameterUse = "InvalidParameterUse"
)
type CypherErr struct {
Msg string
Code string
}
func (err CypherErr) Error() string {
return err.Msg
}
func NewVariableAlreadyBoundErr(name string) error {
return &CypherErr{
Msg: fmt.Sprintf("variable already bound: '%s'", name),
Code: VariableAlreadyBound,
}
}
func NewUndefinedVariableErr(name string) error {
return &CypherErr{
Msg: fmt.Sprintf("undefined variable: '%s'", name),
Code: UndefinedVariable,
}
}
func NewNoSingleRelationshipType() error {
return &CypherErr{
Msg: fmt.Sprintf("no single relationship type"),
Code: NoSingleRelationshipType,
}
}
func NewRequiresDirectedRelationship() error {
return &CypherErr{
Msg: fmt.Sprintf("required directed relationship"),
Code: RequiresDirectedRelationship,
}
}
func NewCreatingVarLength() error {
return &CypherErr{
Msg: fmt.Sprintf("creating variable-length relationship"),
Code: CreatingVarLength,
}
}
func NewInvalidParameterUse() error {
return &CypherErr{
Msg: fmt.Sprintf("invalid parameter use"),
Code: InvalidParameterUse,
}
}