-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.go
55 lines (44 loc) · 1.11 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
package go_ohm
import (
"fmt"
)
type ErrorUnsupportedObjectType struct {
error
}
func newErrorUnsupportedObjectType(nam string) *ErrorUnsupportedObjectType {
return &ErrorUnsupportedObjectType{
fmt.Errorf("the type of object '%s' is unsupported", nam),
}
}
type ErrorRedisCommandFailed struct {
error
}
func newErrorRedisCommandFailed(nam string, err error) *ErrorRedisCommandFailed {
return &ErrorRedisCommandFailed{
fmt.Errorf("execute redis command failed on object '%s': %w", nam, err),
}
}
type ErrorObjectWithoutHashKey struct {
error
}
func newErrorObjectWithoutHashKey(nam string) *ErrorObjectWithoutHashKey {
return &ErrorObjectWithoutHashKey{
fmt.Errorf("can not determine hash key of object '%s'", nam),
}
}
type ErrorBugOccurred struct {
error
}
func newErrorBugOccurred(nam string) *ErrorBugOccurred {
return &ErrorBugOccurred{
fmt.Errorf("bug occurred on object '%s'", nam),
}
}
type ErrorJsonFailed struct {
error
}
func newErrorJsonFailed(nam string, err error) *ErrorJsonFailed {
return &ErrorJsonFailed{
fmt.Errorf("json marshal/unmarshal failed on object '%s': %w", nam, err),
}
}