errors

package
v1.32.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Must added in v1.23.0

func Must[T any](v T, err error) T

func NewSet

func NewSet(e ...error) error

Create a set of errors. Only non-nil parameters are included. If only one non-nil parameter is provided it is simply returned and a set is not actually created.

func Stacktrace

func Stacktrace(err error) error

Stacktrace captures the current stack (excluding itself) and wraps the provided error with it.

Types

type Error

type Error struct {
	Message string      `json:"message"`
	Detail  interface{} `json:"detail,omitempty"`
	Cause   error       `json:"-"`
}

func Errorf

func Errorf(f string, a ...interface{}) *Error

func Wrap

func Wrap(err error, msg string) *Error

func Wrapf

func Wrapf(err error, f string, a ...interface{}) *Error

func (Error) Error

func (e Error) Error() string

func (*Error) SetCause

func (e *Error) SetCause(c error) *Error

func (*Error) SetDetail

func (e *Error) SetDetail(d interface{}) *Error

func (Error) Unwrap

func (e Error) Unwrap() error

type Set

type Set []error

func (Set) Error

func (e Set) Error() string

Conform to error. This method simply concatenates the result of Error() for all the elements of the set and returns the result.

func (Set) Unwrap added in v1.27.0

func (e Set) Unwrap() error

Support error unwrapping. For an error set this simply returns the first error in the set, if any, as the unwrapped value.

Jump to

Keyboard shortcuts

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