eno

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorMap = new(sync.Map)
	// base error
	OK              = New(0, "SUCCESS")
	RequestErr      = New(10400, "Request Error")
	InvalidSignErr  = New(10401, "Invalid Sign")
	InvalidAppidErr = New(10402, "Invalid Appid")
	InvalidTokenErr = New(10403, "Invalid Token")
	NothingFound    = New(10404, "Nothing Found")
	ServerErr       = New(10500, "Server Error")
)

Functions

This section is empty.

Types

type Codes

type Codes interface {
	// sometimes Error return Code in string form
	// NOTE: don't use Error in monitor report even it also work for now
	Error() string
	// Code get error code.
	Code() int
	// Message get code message.
	Message() string
}

Codes eno error interface which has a code & message.

func AnalyseError

func AnalyseError(err error) Codes

analyse error info

type Error

type Error int

A Code is an int error code spec.

func Add

func Add(code int) Error

func Int added in v1.0.2

func Int(i int) Error

Int parse code int to error.

func New

func New(code int, msg string) Error

func (Error) Code

func (e Error) Code() int

Code return error code

func (Error) Error

func (e Error) Error() string

func (Error) Message

func (e Error) Message() string

Message return error message

Jump to

Keyboard shortcuts

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