errorhandler

package
v0.0.0-...-b30c35d Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 an error with a string

func Wrapf

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

Wrapf an error with format string

Types

type ErrorType

type ErrorType uint

ErrorType is the type of an error

const (
	// NoType error
	NoType ErrorType = iota
	// BadRequest error
	BadRequest
	// NotFound error
	NotFound
	// DBError error
	DBError
)

func GetType

func GetType(err error) ErrorType

GetType returns the error type

func (ErrorType) New

func (errorType ErrorType) New(msg string) error

New creates a new customError

func (ErrorType) Newf

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

Newf creates a new customError with formatted message

func (ErrorType) Wrap

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

Wrap creates a new wrapped error

func (ErrorType) Wrapf

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

Wrapf 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