errors

package
v1.2.85 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Top

func Top(err error) string

Top since errors can be wrapped and stacked, it's necessary to get the top level error for tests and validations

func Wrap

func Wrap(previous error, current interface{}) error

Wrap wrap the previous error with current error/ message

Types

type Error

type Error struct {
	Code     string `json:"code,omitempty"`
	Msg      string `json:"msg"`
	Location string `json:"location"`
}

Error type for a new application error

func New

func New(args ...string) *Error

New - create a new error two arguments can be passed! 1. code 2. message if only one argument is passed its considered as message if two arguments are passed then

first argument is considered for code and
second argument is considered for message

func (*Error) Error

func (err *Error) Error() string

Jump to

Keyboard shortcuts

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