-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
68 lines (54 loc) · 1.46 KB
/
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
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
package pixidb
import (
"errors"
"fmt"
)
var (
ErrZeroColumns = errors.New("cannot create a table with zero columns")
)
type TableNotFoundError struct {
Table string
}
func NewTableNotFoundError(tableName string) TableNotFoundError {
return TableNotFoundError{
Table: tableName,
}
}
func (t TableNotFoundError) Error() string {
return fmt.Sprintf("table '%s' not found in database", t.Table)
}
type ColumnNotFoundError struct {
Store string
Column string
}
func NewColumnNotFoundError(store string, column string) *ColumnNotFoundError {
return &ColumnNotFoundError{
Store: store,
Column: column,
}
}
func (c ColumnNotFoundError) Error() string {
return fmt.Sprintf("column '%s' not found in store '%s'", c.Column, c.Store)
}
type LocationNotSupportedError struct {
Projection string
Location Location
}
func NewLocationNotSupportedError(projection string, location Location) *LocationNotSupportedError {
return &LocationNotSupportedError{
Projection: projection,
Location: location,
}
}
func (l LocationNotSupportedError) Error() string {
return fmt.Sprintf("location %v not supported by projection %s", l.Location, l.Projection)
}
type LocationOutOfBoundsError struct {
Location Location
}
func NewLocationOutOfBoundsError(location Location) LocationOutOfBoundsError {
return LocationOutOfBoundsError{Location: location}
}
func (l LocationOutOfBoundsError) Error() string {
return fmt.Sprintf("location %v was out of bounds", l.Location)
}