-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
61 lines (48 loc) · 1.31 KB
/
Copy patherrors.go
File metadata and controls
61 lines (48 loc) · 1.31 KB
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
package dagtask
import (
"errors"
"fmt"
)
var (
ErrCycle = errors.New("dagtask: dependency cycle detected")
ErrDuplicateKey = errors.New("dagtask: duplicate task key")
ErrUnknownDependency = errors.New("dagtask: unknown dependency")
ErrAlreadyExecuted = errors.New("dagtask: dag already executed")
ErrEmptyKey = errors.New("dagtask: empty task key")
ErrNilRun = errors.New("dagtask: nil task run function")
)
type cycleError struct {
path []string
}
func (e *cycleError) Error() string {
return fmt.Sprintf("dagtask: dependency cycle detected: %v", e.path)
}
func (e *cycleError) Unwrap() error {
return ErrCycle
}
type duplicateKeyError struct {
key string
}
func (e *duplicateKeyError) Error() string {
return fmt.Sprintf("dagtask: duplicate task key %q", e.key)
}
func (e *duplicateKeyError) Unwrap() error {
return ErrDuplicateKey
}
type unknownDependencyError struct {
task string
dep string
}
func (e *unknownDependencyError) Error() string {
return fmt.Sprintf("dagtask: task %q depends on unknown key %q", e.task, e.dep)
}
func (e *unknownDependencyError) Unwrap() error {
return ErrUnknownDependency
}
type PanicError struct {
Key string
Val any
}
func (e *PanicError) Error() string {
return fmt.Sprintf("dagtask: task %q panicked: %v", e.Key, e.Val)
}