/
errors.go
43 lines (32 loc) · 867 Bytes
/
errors.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
package mongodb
import (
"fmt"
"github.com/pboyd04/godata/filter/parser"
)
type UnsupportedOperandError struct {
operand interface{}
}
type UnsupportedOperatorError struct {
operator parser.Operator
}
type ParserError struct {
message string
}
func (e *UnsupportedOperandError) Error() string {
return fmt.Sprintf("unsupported operand: %#v", e.operand)
}
func newUnsupportedOperandError(operand interface{}) error {
return &UnsupportedOperandError{operand: operand}
}
func (e *UnsupportedOperatorError) Error() string {
return fmt.Sprintf("unsupported operator: %v", e.operator)
}
func newUnsupportedOperatorError(operator parser.Operator) error {
return &UnsupportedOperatorError{operator: operator}
}
func (e *ParserError) Error() string {
return e.message
}
func newParserError(message string) error {
return &ParserError{message: message}
}