blob: 1681dd564dbba15418fe4595e928cfa9e4c31f77 (
plain)
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
|
package database
import "fmt"
// database init error
type InitError struct {
path string
err error
}
func (e *InitError) Error() string {
return fmt.Sprintf("Failed to open database : %s", e.path)
}
func (e *InitError) Unwrap() error { return e.err }
func newInitError(path string, err error) error {
return &InitError{
path: path,
err: err,
}
}
// database migration error
type MigrationError struct {
version int
err error
}
func (e *MigrationError) Error() string {
return fmt.Sprintf("Failed to migrate database to version %d : %s", e.version, e.err)
}
func (e *MigrationError) Unwrap() error { return e.err }
func newMigrationError(version int, err error) error {
return &MigrationError{
version: version,
err: err,
}
}
// database transaction error
type TransactionError struct {
msg string
err error
}
func (e *TransactionError) Error() string {
return fmt.Sprintf("Failed to perform transaction : %s", e.msg)
}
func (e *TransactionError) Unwrap() error { return e.err }
func newTransactionError(msg string, err error) error {
return &TransactionError{
msg: msg,
err: err,
}
}
|