errorschain

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

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

Chain defines an error chain

func New

func New(opts ...ChainOption) *Chain

New creates a new error chain. All errors will be evaluated respectively according to their insertion order

func (*Chain) AddError

func (c *Chain) AddError(err error) *Chain

AddError add an error to the chain

func (*Chain) AddErrors added in v2.8.0

func (c *Chain) AddErrors(errs ...error) *Chain

AddErrors add a slice of errors to the chain. Remember the slice order does matter here

func (*Chain) Error

func (c *Chain) Error() error

Error returns the error

type ChainOption

type ChainOption func(*Chain)

ChainOption configures a validation chain at creation time.

func ReturnAll

func ReturnAll() ChainOption

ReturnAll sets whether a chain should return all errors.

func ReturnFirst

func ReturnFirst() ChainOption

ReturnFirst sets whether a chain should stop validation on first error.

Jump to

Keyboard shortcuts

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