mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
7bb6dbe36b
Moving (most) source to v1 root package to prepare for v0/v1 API separation. Signed-off-by: Johan Fylling <johan.dev@fylling.se>
25 lines
600 B
Go
25 lines
600 B
Go
package rego
|
|
|
|
// HaltError is an error type to return from a custom function implementation
|
|
// that will abort the evaluation process (analogous to topdown.Halt).
|
|
type HaltError struct {
|
|
err error
|
|
}
|
|
|
|
// Error delegates to the wrapped error
|
|
func (h *HaltError) Error() string {
|
|
return h.err.Error()
|
|
}
|
|
|
|
// NewHaltError wraps an error such that the evaluation process will stop
|
|
// when it occurs.
|
|
func NewHaltError(err error) error {
|
|
return &HaltError{err: err}
|
|
}
|
|
|
|
// ErrorDetails interface is satisfied by an error that provides further
|
|
// details.
|
|
type ErrorDetails interface {
|
|
Lines() []string
|
|
}
|