-
Notifications
You must be signed in to change notification settings - Fork 538
/
errors.go
41 lines (31 loc) · 1.55 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
package workflowstore
import (
"fmt"
"github.com/pkg/errors"
)
// ErrStaleWorkflowError signals that the local copy of workflow is Stale, i.e., a new version was written to the datastore,
// But the informer cache has not yet synced to the latest copy
var ErrStaleWorkflowError = fmt.Errorf("stale Workflow Found error")
// ErrWorkflowNotFound indicates that the workflow does not exist and it is safe to ignore the event
var ErrWorkflowNotFound = fmt.Errorf("workflow not-found error")
// ErrWorkflowTerminated indicates that the workflow being operated on has previously been stored in a terminal state.
var ErrWorkflowTerminated = fmt.Errorf("workflow has already been terminated")
// ErrWorkflowToLarge is returned in cased an update operation fails because the Workflow object (CRD) has surpassed the Datastores
// supported limit.
var ErrWorkflowToLarge = fmt.Errorf("workflow too large")
// IsNotFound returns true if the error is caused by ErrWorkflowNotFound
func IsNotFound(err error) bool {
return errors.Cause(err) == ErrWorkflowNotFound
}
// IsWorkflowStale returns true if the error is caused by ErrStaleWorkflowError
func IsWorkflowStale(err error) bool {
return errors.Cause(err) == ErrStaleWorkflowError
}
// IsWorkflowTerminated returns true if the error is caused by ErrWorkflowTerminated
func IsWorkflowTerminated(err error) bool {
return errors.Cause(err) == ErrWorkflowTerminated
}
// IsWorkflowTooLarge returns true if the error is caused by ErrWorkflowToLarge
func IsWorkflowTooLarge(err error) bool {
return errors.Cause(err) == ErrWorkflowToLarge
}