-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
54 lines (46 loc) · 1.13 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
package propagatedstorage
import (
"fmt"
)
// BaseError ..
type BaseError struct {
err error
msg string
}
func (e *BaseError) Error() string {
if e.err != nil {
return fmt.Sprintf("%s: %s", e.msg, e.err.Error())
}
return e.msg
}
// Unwrap ..
func (e *BaseError) Unwrap() error {
return e.err
}
// Wrap ..
func (e *BaseError) Wrap(err error) *BaseError {
e.err = err
return e
}
// NewError ..
func NewError(message string) *BaseError {
err := new(BaseError)
err.msg = message
return err
}
var (
// ErrVersionOutdated ..
ErrVersionOutdated = NewError("version outdated")
// ErrDatastoreFailed ..
ErrDatastoreFailed = NewError("datastore failed")
// ErrMissingFallbackService ...
ErrMissingFallbackService = NewError("missing fallback service")
// ErrServiceFailed ..
ErrServiceFailed = NewError("service failed")
// ErrMissingDatastoreSession ..
ErrMissingDatastoreSession = NewError("session not found")
// ErrInitiateDatastoreDriver ..
ErrInitiateDatastoreDriver = NewError("failed to initiate driver")
// ErrFetchItemFromService ..
ErrFetchItemFromService = NewError("failed to fetch item from fallback service")
)