errors

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Overview

Package errors provides a way to return detailed information for a request error. The error is normally JSON encoded.

Index

Constants

View Source
const (
	UnsupportedError = String("unsupported error")
)

Variables

View Source
var (
	// Append is a helper function that will append more merr
	Append = merr.Append
	// ListFormatFunc is a helper function that will format the merr
	ListFormatFunc = merr.ListFormatFunc
)

Functions

func As

func As(err error, target interface{}) bool

func Cause added in v0.0.3

func Cause(err error) error

func ErrorFormatJSON added in v0.0.3

func ErrorFormatJSON(i []error) string

func Errorf

func Errorf(format string, args ...interface{}) error

func Is

func Is(err, target error) bool

func Join

func Join(errs ...error) error

func New

func New(message string) error

func Stack

func Stack(v string) error

func Stackf

func Stackf(format string, args ...interface{}) error

func Unwrap

func Unwrap(err error) error

func WithStack added in v0.0.3

func WithStack(err error) error

func Wrap

func Wrap(err error, message string) error

func Wrapf

func Wrapf(err error, format string, args ...interface{}) error

Types

type ErrorFormatFunc

type ErrorFormatFunc = merr.ErrorFormatFunc

ErrorFormatFunc is a helper function that will format the merr

type MultiError

type MultiError = merr.Error

MultiError is an alias of `github.com/hashicorp/go-multierror`.Error

type String added in v0.0.3

type String string

func ErrString added in v0.0.3

func ErrString(err string) String

ErrString creates a new error from a string

func (String) Error added in v0.0.3

func (obj String) Error() string

Error returns the JSON representation of the error

func (String) Is added in v0.0.3

func (obj String) Is(err error) bool

Is checks whether the error is equal to the

func (String) String added in v0.0.3

func (obj String) String() string

String returns the JSON representation of the error

type ThreadSafeMultiError

type ThreadSafeMultiError struct {
	ErrorFormat ErrorFormatFunc
	// contains filtered or unexported fields
}

ThreadSafeMultiError represents a collection of merr

func ThreadSafe

func ThreadSafe(err error, fns ...ErrorFormatFunc) *ThreadSafeMultiError

ThreadSafe creates a new ThreadSafeMultiError collection

func (*ThreadSafeMultiError) Append

func (e *ThreadSafeMultiError) Append(err error)

Append adds an error to the MultiError collection

func (*ThreadSafeMultiError) Error

func (e *ThreadSafeMultiError) Error() string

Error returns the JSON representation of the MultiError collection

func (*ThreadSafeMultiError) Errors

func (e *ThreadSafeMultiError) Errors() []error

Errors returns the merr collection

func (*ThreadSafeMultiError) Has

func (e *ThreadSafeMultiError) Has(err any) error

Has checks if the MultiError collection has the given merr or not

func (*ThreadSafeMultiError) HasErrors

func (e *ThreadSafeMultiError) HasErrors() bool

HasErrors checks if the MultiError collection has any merr

func (*ThreadSafeMultiError) Unsafe

func (e *ThreadSafeMultiError) Unsafe() *MultiError

Unsafe returns the MultiError collection

Directories

Path Synopsis
Package rpc provides a way to return detailed information for an RPC request error.
Package rpc provides a way to return detailed information for an RPC request error.

Jump to

Keyboard shortcuts

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