Documentation ¶
Overview ¶
Package errors provides errors for the evaluator engine
Index ¶
- Variables
- func AlertErrorAsString(err error) string
- func AlertStatusAsError(prevStatus *db.ListRuleEvaluationsByProfileIdRow) error
- func ErrorAsAlertStatus(err error) db.AlertStatusTypes
- func ErrorAsEvalDetails(err error) string
- func ErrorAsEvalStatus(err error) db.EvalStatusTypes
- func ErrorAsRemediationStatus(err error) db.RemediationStatusTypes
- func EvalErrorAsString(err error) string
- func HTTPErrorCodeToErr(httpCode int) error
- func IsActionFatalError(err error) bool
- func IsActionInformativeError(err error) bool
- func LimitedWriter(w io.Writer, n int64) io.Writer
- func NewDetailedErrEvaluationFailed(tmpl string, tmplArgs any, sfmt string, args ...any) error
- func NewErrActionFailed(sfmt string, args ...any) error
- func NewErrEvaluationFailed(sfmt string, args ...any) error
- func NewErrEvaluationSkipSilently(sfmt string, args ...any) error
- func NewErrEvaluationSkipped(sfmt string, args ...any) error
- func RemediationErrorAsString(err error) string
- func RemediationStatusAsError(prevStatus *db.ListRuleEvaluationsByProfileIdRow) error
- type ActionsError
- type EvaluationError
Constants ¶
This section is empty.
Variables ¶
var ( errors.New("unauthorized") // ErrForbidden is returned when a request is forbidden ErrForbidden = errors.New("forbidden") // ErrNotFound is returned when a resource is not found ErrNotFound = errors.New("not found") // ErrValidateOrSpammed is returned when a request is a validation or spammed error ErrValidateOrSpammed = errors.New("validation or spammed error") // ErrClientError is returned when a request is a client error ErrClientError = errors.New("client error") // ErrServerError is returned when a request is a server error ErrServerError = errors.New("server error") // ErrOther is returned when a request is another error ErrOther = errors.New("other error") )ErrUnauthorized =
var ErrActionFailed = errors.New("action failed")
ErrActionFailed is an error code that indicates that the action was attempted but failed.
var ErrActionNotAvailable = errors.New("action not available")
ErrActionNotAvailable is an error code that indicates that the action was not available for this rule_type
var ErrActionPending = errors.New("action pending")
ErrActionPending is an error code that indicates that the action was performed but is pending, i.e., opened a PR.
var ErrActionSkipped = errors.New("action skipped")
ErrActionSkipped is an error code that indicates that the action was not performed at all because the evaluation passed and the action was not needed
var ErrActionTurnedOff = errors.New("action turned off")
ErrActionTurnedOff is an error code that indicates that the action is turned off for this rule_type
var ErrEvaluationFailed = errors.New("evaluation failure")
ErrEvaluationFailed is an error that occurs during evaluation of a rule.
var ErrEvaluationSkipSilently = errors.New("evaluation skipped silently")
ErrEvaluationSkipSilently specifies that the rule was evaluated but skipped silently.
var ErrEvaluationSkipped = errors.New("evaluation skipped")
ErrEvaluationSkipped specifies that the rule was evaluated but skipped.
var ErrInternal = errors.New("internal minder error")
ErrInternal is an error that occurs when there is an internal error in the minder engine.
Functions ¶
func AlertErrorAsString ¶
AlertErrorAsString returns the alert error as a string
func AlertStatusAsError ¶
func AlertStatusAsError(prevStatus *db.ListRuleEvaluationsByProfileIdRow) error
AlertStatusAsError returns the error for a given alert status
func ErrorAsAlertStatus ¶
func ErrorAsAlertStatus(err error) db.AlertStatusTypes
ErrorAsAlertStatus returns the alert status for a given error
func ErrorAsEvalDetails ¶
ErrorAsEvalDetails returns the evaluation details for a given error
func ErrorAsEvalStatus ¶
func ErrorAsEvalStatus(err error) db.EvalStatusTypes
ErrorAsEvalStatus returns the evaluation status for a given error
func ErrorAsRemediationStatus ¶
func ErrorAsRemediationStatus(err error) db.RemediationStatusTypes
ErrorAsRemediationStatus returns the remediation status for a given error
func EvalErrorAsString ¶
EvalErrorAsString returns the evaluation error as a string
func HTTPErrorCodeToErr ¶
HTTPErrorCodeToErr converts an HTTP error code to an error
func IsActionFatalError ¶
IsActionFatalError returns true if the error is a fatal error that should stop be reported to the user
func IsActionInformativeError ¶
IsActionInformativeError returns true if the error is an informative error that should not be reported to the user
func LimitedWriter ¶
LimitedWriter returns a writer that allows up to `n` bytes being written. If more than `n` total bytes are written, `io.ErrShortBuffer` is returned.
func NewDetailedErrEvaluationFailed ¶
NewDetailedErrEvaluationFailed creates a new evaluation error with a given error message and a templated detail message.
func NewErrActionFailed ¶
NewErrActionFailed creates a new action error
func NewErrEvaluationFailed ¶
NewErrEvaluationFailed creates a new evaluation error with a formatted message.
func NewErrEvaluationSkipSilently ¶
NewErrEvaluationSkipSilently creates a new evaluation error
func NewErrEvaluationSkipped ¶
NewErrEvaluationSkipped creates a new evaluation error
func RemediationErrorAsString ¶
RemediationErrorAsString returns the remediation error as a string
func RemediationStatusAsError ¶
func RemediationStatusAsError(prevStatus *db.ListRuleEvaluationsByProfileIdRow) error
RemediationStatusAsError returns the remediation status for a given error
Types ¶
type ActionsError ¶
type ActionsError struct { RemediateErr error RemediateMeta json.RawMessage AlertErr error AlertMeta json.RawMessage }
ActionsError is the error wrapper for actions
type EvaluationError ¶
EvaluationError is a custom error type for evaluation errors.
func (*EvaluationError) Details ¶
func (e *EvaluationError) Details() string
Details returns a pretty-printed message detailing the reason of the failure.
func (*EvaluationError) Error ¶
func (e *EvaluationError) Error() string
Error implements the error interface for EvaluationError.
func (*EvaluationError) Unwrap ¶
func (e *EvaluationError) Unwrap() error
Unwrap returns the base error, allowing errors.Is to work with wrapped errors.