Files
2025-07-31 08:05:37 +00:00

50 lines
724 B
Go

package classification
import (
"fmt"
"strings"
)
type Error interface {
error
Key() string
}
type WorkflowError struct {
key string
message string
}
func (e WorkflowError) Error() string {
if e.message != "" {
return e.message
}
return fmt.Sprintf("workflow failed: %s", e.key)
}
func (e WorkflowError) Key() string {
return e.key
}
var ErrUnmatched = WorkflowError{
key: "unmatched",
}
var ErrDeleteTorrent = WorkflowError{
key: "delete_torrent",
}
type RuntimeError struct {
Path []string
Cause error
}
func (e RuntimeError) Error() string {
return fmt.Sprintf("runtime error at Path %s: %s", strings.Join(e.Path, "."), e.Cause)
}
func (e RuntimeError) Unwrap() error {
return e.Cause
}