simplerr

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: MIT Imports: 4 Imported by: 3

README

simplerr

Documentation

Overview

Package simplerr implement error with code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetText added in v0.2.0

func GetText(err error) string

func HasCode

func HasCode(err error, code ErrCodeInterface) bool

func Is

func Is(err, target error) bool

func WithCode added in v0.4.0

func WithCode(err error, code ErrCodeInterface) error

func Wrap

func Wrap(err error, msg string) error

func WrapWithCode

func WrapWithCode(err error, code ErrCodeInterface, msg string) error

func Wrapf

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

func WrapfWithCode

func WrapfWithCode(err error, code ErrCodeInterface, tmpl string, args ...interface{}) error

Types

type Call

type Call struct {
	Line     int
	File     string
	FuncName string
}

func GetStack

func GetStack(err error) []Call

type ErrCode added in v0.5.0

type ErrCode int

func (*ErrCode) GRPC added in v0.5.0

func (e *ErrCode) GRPC() int

func (*ErrCode) HTTP added in v0.5.0

func (e *ErrCode) HTTP() int

func (*ErrCode) Int added in v0.5.0

func (e *ErrCode) Int() int

type ErrCodeInterface added in v0.5.0

type ErrCodeInterface interface {
	HTTP() int
	GRPC() int
	Int() int
}

func GetCode

func GetCode(err error) ErrCodeInterface

Jump to

Keyboard shortcuts

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