Skip to content

Commit 3ce6b2f

Browse files
committed
fix: cleaned up errors code
- Parse errors are joined by "|" instead of "," - Safer checking of generic errors Signed-off-by: Calum Murray <[email protected]>
1 parent a72f4a8 commit 3ce6b2f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sql/v2/errors/errors.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const (
1919
missingAttributeError
2020
missingFunctionError
2121
functionEvaluationError
22+
dummyLastError // always add new error classes ABOVE this error
2223
)
2324

2425
type cesqlError struct {
@@ -62,7 +63,7 @@ func NewParseError(errs []error) error {
6263

6364
return cesqlError{
6465
kind: parseError,
65-
message: strings.Join(errorMessages, ","),
66+
message: strings.Join(errorMessages, "|"),
6667
}
6768
}
6869

@@ -145,7 +146,7 @@ func NewFunctionEvaluationError(err error) error {
145146

146147
func IsGenericError(err error) bool {
147148
if cesqlErr, ok := err.(cesqlError); ok {
148-
return cesqlErr.kind < parseError || cesqlErr.kind > functionEvaluationError
149+
return cesqlErr.kind < 0 || cesqlErr.kind >= dummyLastError
149150
}
150151
return false
151152
}

0 commit comments

Comments
 (0)