mirror of
https://github.com/docker/docker-agent.git
synced 2026-11-04 10:02:15 +00:00
18 lines
586 B
Go
18 lines
586 B
Go
package evaluator
|
|
|
|
import "errors"
|
|
|
|
// TerminalError marks a failure that must end the run. Callers with a fallback
|
|
// for ordinary assessment failures must not apply it to a terminal one, such
|
|
// as an exhausted budget or untrustworthy usage accounting.
|
|
type TerminalError struct{ Err error }
|
|
|
|
func (e *TerminalError) Error() string { return e.Err.Error() }
|
|
func (e *TerminalError) Unwrap() error { return e.Err }
|
|
|
|
// IsTerminal reports whether err, or any error it wraps, is terminal.
|
|
func IsTerminal(err error) bool {
|
|
var terminal *TerminalError
|
|
return errors.As(err, &terminal)
|
|
}
|