-
Notifications
You must be signed in to change notification settings - Fork 85
/
imagenotfound.go
62 lines (51 loc) · 1.24 KB
/
imagenotfound.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
package bacerrors
import (
"fmt"
)
type ImageNotFound GenericError
func NewImageNotFound(id string) *ImageNotFound {
var e ImageNotFound
e.Code = ErrorCodeImageNotFound
e.Message = fmt.Sprintf(ErrorMessageImageNotFound, id)
e.Details = make(map[string]interface{})
e.SetError(fmt.Errorf("%s", e.Message))
return &e
}
func (e *ImageNotFound) GetMessage() string {
return e.Message
}
func (e *ImageNotFound) SetMessage(s string) {
e.Message = s
}
func (e *ImageNotFound) Error() string {
return e.GetError().Error()
}
func (e *ImageNotFound) GetError() error {
return e.Err
}
func (e *ImageNotFound) SetError(err error) {
e.Err = err
}
func (e *ImageNotFound) GetCode() string {
return ErrorCodeImageNotFound
}
func (e *ImageNotFound) SetCode(string) {
e.Code = ErrorCodeImageNotFound
}
func (e *ImageNotFound) GetDetails() map[string]interface{} {
return e.Details
}
func (e *ImageNotFound) GetImageName() string {
if id, ok := e.Details["imagename"]; ok {
return id.(string)
}
return ""
}
func (e *ImageNotFound) SetImageName(s string) {
e.Details["imagename"] = s
}
const (
ErrorCodeImageNotFound = "error-image-not-found"
ErrorMessageImageNotFound = "Image not found. Image: %s"
)
var _ BacalhauErrorInterface = (*ImageNotFound)(nil)