diff options
Diffstat (limited to 'pkg/aflow/execute.go')
| -rw-r--r-- | pkg/aflow/execute.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pkg/aflow/execute.go b/pkg/aflow/execute.go index 4133c01c9..482a58fb4 100644 --- a/pkg/aflow/execute.go +++ b/pkg/aflow/execute.go @@ -5,6 +5,7 @@ package aflow import ( "context" + "errors" "fmt" "maps" "os" @@ -70,6 +71,25 @@ func (flow *Flow) Execute(c context.Context, model, workdir string, inputs map[s return span.Results, nil } +// FlowError creates an error that denotes failure of the flow itself, +// rather than an infrastructure error. A flow errors mean an expected +// condition in the flow when it cannot continue, and cannot produce +// expected outputs. For example, if we are doing something with the kernel, +// but the kernel build fails. Flow errors shouldn't be flagged in +// infrastructure monitoring. +func FlowError(err error) error { + return &flowError{err} +} + +func IsFlowError(err error) bool { + var flowErr *flowError + return errors.As(err, &flowErr) +} + +type flowError struct { + error +} + type ( onEvent func(*trajectory.Span) error generateContentFunc func(*genai.GenerateContentConfig, []*genai.Content) ( |
