errors

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2018 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error interface {
	error

	// Status returns the error code
	ErrorCode() ErrorCode
	// Generate log msg
	GenerateLogMsg() string
	// Generate client error msg
	GenerateClientErrorMsg() string
}

Error extends error with additional context

func CreateError

func CreateError(err error, code ErrorCode, msg string) Error

CreateError returns custom error

func Errorf

func Errorf(code ErrorCode, fmt string, args ...interface{}) Error

Errorf returns a new Error

func GetError

func GetError(err error) (Error, bool)

GetError returns custom error

func New

func New(code ErrorCode, msg string) Error

New returns a new Error

func WithMessage

func WithMessage(code ErrorCode, err error, msg string) Error

WithMessage returns a new Error

func Wrap

func Wrap(code ErrorCode, cause error, msg string) Error

Wrap returns a new Error

func Wrapf

func Wrapf(code ErrorCode, cause error, fmt string, args ...interface{}) Error

Wrapf returns a new Error

type ErrorCode

type ErrorCode int

ErrorCode error code

const (
	// GeneralError generic error
	GeneralError ErrorCode = iota
)

Jump to

Keyboard shortcuts

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