-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
66 lines (50 loc) · 1.39 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
56
57
58
59
60
61
62
63
64
65
66
package lambdag
import "fmt"
type UnknownError struct {
err error
}
func (err UnknownError) Error() string {
return fmt.Sprintf("unexpected:%s", err.err.Error())
}
func (err UnknownError) Unwrap() error {
return err.err
}
type TaskIDDuplicateError struct {
TaskID string
}
func (err *TaskIDDuplicateError) Error() string {
return fmt.Sprintf("task id `%s` is already exists", err.TaskID)
}
type TaskDependencyDuplicateError struct {
Ancestor *Task
Descendant *Task
}
func (err *TaskDependencyDuplicateError) Error() string {
return fmt.Sprintf("dependency from `%s` to `%s` already exists", err.Ancestor.ID(), err.Descendant.ID())
}
type AncestorDescendantSameError struct {
Ancestor *Task
Descendant *Task
}
func (err *AncestorDescendantSameError) Error() string {
return fmt.Sprintf("ancestor `%s` and descendant `%s` is same", err.Ancestor.ID(), err.Descendant.ID())
}
type CycleDetectedInDAGError struct {
Start *Task
End *Task
}
func (err *CycleDetectedInDAGError) Error() string {
return fmt.Sprintf("cycle detected in DAG: between `%s` to `%s`", err.Start.ID(), err.End.ID())
}
type TaskRetryableError struct {
err error
}
func (err TaskRetryableError) Error() string {
return fmt.Sprintf("task retryable:%s", err.err.Error())
}
func (err TaskRetryableError) Unwrap() error {
return err.err
}
func WrapTaskRetryable(err error) error {
return &TaskRetryableError{err: err}
}