errors

package
v0.0.6-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoType = ErrorType(iota)
	BadRequest
	NotFound
)

Variables

This section is empty.

Functions

func AddErrorContext

func AddErrorContext(err error, field, message string) error

AddErrorContext adds a context to an error

func Cause

func Cause(err error) error

Cause gives the original error

func GetErrorContext

func GetErrorContext(err error) map[string]string

GetErrorContext returns the error context

func New

func New(msg string) error

New creates a no type error

func Newf

func Newf(msg string, args ...interface{}) error

Newf creates a no type error with formatted message

func Wrap

func Wrap(err error, msg string) error

Wrap wrans an error with a string

func Wrapf

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

Wrapf wraps an error with format string

Types

type ErrorType

type ErrorType uint

func GetType

func GetType(err error) ErrorType

GetType returns the error type

func (ErrorType) New

func (typ ErrorType) New(msg string) error

New creates a new customError

func (ErrorType) Newf

func (typ ErrorType) Newf(msg string, args ...interface{}) error

New creates a new customError with formatted message

func (ErrorType) Wrap

func (typ ErrorType) Wrap(err error, msg string) error

Wrap creates a new wrapped error

func (ErrorType) Wrapf

func (typ ErrorType) Wrapf(err error, msg string, args ...interface{}) error

Wrap creates a new wrapped error with formatted message

Jump to

Keyboard shortcuts

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