errors

package
v0.64.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InvalidConfigErr is the error code returned if the OPA initialization fails due to an invalid config.
	InvalidConfigErr string = "invalid_config"

	// InvalidPolicyOrDataErr is the error code returned if either policy or data is invalid.
	InvalidPolicyOrDataErr string = "invalid_policy_or_data"

	// InvalidBundleErr is the error code returned if the bundle loaded is corrupted.
	InvalidBundleErr string = "invalid_bundle"

	// NotReadyErr is the error code returned if the OPA instance is not initialized.
	NotReadyErr string = "not_ready"

	// InternalErr is the error code returned if the evaluation fails due to an internal error.
	InternalErr string = "internal_error"

	// CancelledErr is the error code returned if the evaluation is cancelled.
	CancelledErr string = "cancelled"
)

Variables

This section is empty.

Functions

func IsCancel added in v0.29.0

func IsCancel(err error) bool

IsCancel returns true if err was caused by cancellation.

func IsError added in v0.29.0

func IsError(err error) bool

IsError returns true if the err is an Error.

func New added in v0.29.0

func New(code, msg string) error

New returns a new error with the passed code

Types

type Error added in v0.29.0

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message,omitempty"`
}

Error is the error code type returned by the SDK functions when an error occurs.

func (*Error) Error added in v0.29.0

func (e *Error) Error() string

func (*Error) Is added in v0.29.0

func (e *Error) Is(target error) bool

Is allows matching error types using errors.Is (see IsCancel).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL