-
Notifications
You must be signed in to change notification settings - Fork 85
/
jobnotfound.go
64 lines (53 loc) · 1.2 KB
/
jobnotfound.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
63
64
package bacerrors
import (
"fmt"
)
type JobNotFound GenericError
func NewJobNotFound(id string) *JobNotFound {
var e JobNotFound
e.Code = ErrorCodeJobNotFound
e.Message = fmt.Sprintf(ErrorMessageJobNotFound, id)
e.Details = make(map[string]interface{})
e.Details["id"] = id
e.SetID(id)
e.SetError(fmt.Errorf("%s", e.Message))
return &e
}
func (e *JobNotFound) GetMessage() string {
return e.Message
}
func (e *JobNotFound) SetMessage(s string) {
e.Message = s
}
func (e *JobNotFound) Error() string {
return e.GetError().Error()
}
func (e *JobNotFound) GetError() error {
return e.Err
}
func (e *JobNotFound) SetError(err error) {
e.Err = err
}
func (e *JobNotFound) GetCode() string {
return ErrorCodeJobNotFound
}
func (e *JobNotFound) SetCode(string) {
e.Code = ErrorCodeJobNotFound
}
func (e *JobNotFound) GetDetails() map[string]interface{} {
return e.Details
}
func (e *JobNotFound) GetID() string {
if id, ok := e.Details["id"]; ok {
return id.(string)
}
return ""
}
func (e *JobNotFound) SetID(s string) {
e.Details["id"] = s
}
const (
ErrorCodeJobNotFound = "error-job-not-found"
ErrorMessageJobNotFound = "Job not found. ID: %s"
)
var _ BacalhauErrorInterface = (*JobNotFound)(nil)