generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 77
/
error.go
16 lines (12 loc) · 831 Bytes
/
error.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package policies
import "github.com/layer5io/meshkit/errors"
const (
ErrPrepareForEvalCode = "11098"
ErrEvalCode = "11099"
)
func ErrPrepareForEval(err error) error {
return errors.New(ErrPrepareForEvalCode, errors.Alert, []string{"error preparing for evaluation"}, []string{err.Error()}, []string{"query might be empty", "rego store provided without associated transaction", "uncommitted transaction"}, []string{"please provide the transaction for the loaded store"})
}
func ErrEval(err error) error {
return errors.New(ErrEvalCode, errors.Alert, []string{"error evaluating policy for the given input"}, []string{err.Error()}, []string{"The policy query is invalid, see: https://github.com/open-policy-agent/opa/blob/main/rego/resultset.go (Allowed func)"}, []string{"please provide a valid non-empty query"})
}