errors

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilSchema = errors.New("nil schema")
)

Functions

func AddError

func AddError(perr *error, err error, loc string)

AddError adds an error, which may be a validation error, to another error.

func AddValidationErrorStruct

func AddValidationErrorStruct(perr *error, ve *ValidationError)

AddValidationErrorStruct adds a ValidationError to an existing error. The provided ve should already have basic fields populated.

func IsValidationError

func IsValidationError(err error) bool

IsValidationError reports whether err is a validation error.

func NewValidateError added in v0.0.10

func NewValidateError(err error, errs []*ValidationError) error

Types

type ValidateError added in v0.0.10

type ValidateError struct {
	Errors []*ValidationError
	// contains filtered or unexported fields
}

type ValidationError

type ValidationError struct {
	// Basic output fields per JSON Schema output format (basic):
	// https://json-schema.org/draft/2020-12/json-schema-core.html#name-output-formats
	// These are the canonical fields consumers should use.
	Message          string `json:"error"`
	KeywordLocation  string `json:"keywordLocation"`
	InstanceLocation string `json:"instanceLocation"`
}

ValidationError is returned by a validation function when an instance fails validation.

func (*ValidationError) Error

func (ve *ValidationError) Error() string

Error returns the error message that a user should see. This implements the error interface.

type ValidationErrors

type ValidationErrors struct {
	Errs []*ValidationError
}

ValidationErrors is a collection of ValidationError values.

func (*ValidationErrors) Error

func (ves *ValidationErrors) Error() string

Error returns the error message that a user should see. This implements the error interface.

Jump to

Keyboard shortcuts

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