errors

package
v2.0.0-...-02ad64b Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge

func Merge(dst, src error, failFast bool) (ok bool, err error)

Merge is a utility to resolve and combine errors resulting from evaluation. If ok is false, execution of validation should stop (either due to failFast or the result is not a ValidationError).

func PrefixErrorPaths

func PrefixErrorPaths(err error, prefix string)

PrefixErrorPaths prepends the prefix to the violations of a ValidationError.

func PrefixFieldPaths

func PrefixFieldPaths(err *ValidationError, format string, args ...any)

PrefixFieldPaths prepends to the provided prefix to the error's internal field paths.

Types

type CompilationError

type CompilationError struct {
	// contains filtered or unexported fields
}

A CompilationError is returned if a CEL expression cannot be compiled & type-checked or if invalid standard constraints are applied.

func NewCompilationError

func NewCompilationError(cause error) *CompilationError

NewCompilationError creates a new CompilationError with the provided cause.

func NewCompilationErrorf

func NewCompilationErrorf(format string, args ...any) *CompilationError

NewCompilationErrorf creates a new CompilationError, constructing a causal error from the provided format and args.

func (*CompilationError) Error

func (err *CompilationError) Error() string

func (*CompilationError) Unwrap

func (err *CompilationError) Unwrap() error

type RuntimeError

type RuntimeError struct {
	// contains filtered or unexported fields
}

A RuntimeError is returned if a valid CEL expression evaluation is terminated. The two built-in reasons are 'no_matching_overload' when a CEL function has no overload for the types of the arguments or 'no_such_field' when a map or message does not contain the desired field.

func NewRuntimeError

func NewRuntimeError(cause error) *RuntimeError

NewRuntimeError creates a new RuntimeError with the provided cause.

func NewRuntimeErrorf

func NewRuntimeErrorf(format string, args ...any) *RuntimeError

NewRuntimeErrorf creates a new RuntimeError, constructing a causal error from the provided format and args.

func (*RuntimeError) Error

func (err *RuntimeError) Error() string

func (*RuntimeError) Unwrap

func (err *RuntimeError) Unwrap() error

type ValidationError

type ValidationError validate.Violations

A ValidationError is returned if one or more constraint violations were detected.

func (*ValidationError) Error

func (err *ValidationError) Error() string

func (*ValidationError) ToProto

func (err *ValidationError) ToProto() *validate.Violations

ToProto converts this error into its proto.Message form.

Jump to

Keyboard shortcuts

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