-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmach_errors.go
More file actions
40 lines (36 loc) · 1.47 KB
/
mach_errors.go
File metadata and controls
40 lines (36 loc) · 1.47 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
package mach
import "fmt"
var ErrDatabaseMach = func(code int, msg string) error {
return fmt.Errorf("MACH-ERR %d %s", code, msg)
}
var ErrDatabaseCli = func(fn string, code int, msg string) error {
if code == 0 {
return fmt.Errorf("MACHCLI-ERR %s, %s", msg, fn)
} else {
return fmt.Errorf("MACHCLI-ERR %d %s, %s", code, msg, fn)
}
}
var ErrDatabaseReturns = func(fn string, rt int) error {
return fmt.Errorf("%s returns %d", fn, rt)
}
var ErrDatabaseReturnsAtIdx = func(fn string, idx int, rt int) error {
return fmt.Errorf("%s idx %d returns %d", fn, idx, rt)
}
var ErrDatabaseWrap = func(fn string, cause error) error {
return fmt.Errorf("%s %s", fn, cause.Error())
}
var ErrDatabaseAppendUnknownType = func(typ string) error {
return fmt.Errorf("MachAppendData unknown column type '%s'", typ)
}
var ErrDatabaseAppendWrongType = func(actual any, column string, typ string) error {
return fmt.Errorf("MachAppendData cannot apply %T to %s (%s)", actual, column, typ)
}
var ErrDatabaseAppendWrongTimeValueType = func(actual string, column string, typ string) error {
return fmt.Errorf("MachAppendData cannot apply %s to %s (%s)", actual, column, typ)
}
var ErrDatabaseAppendWrongTimeStringType = func(column string, typ string) error {
return fmt.Errorf("MachAppendData cannot apply string without format to %s (%s)", column, typ)
}
var ErrDatabaseAppendWrongValueCount = func(expect int, actual int) error {
return fmt.Errorf("MachAppendData required %d, but got %d", expect, actual)
}