ecode

package
Version: v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// 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
	Error() string
	// Code get error code.
	Code() int
	// Message get code message.
	Message() string
}

Codes ecode 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

Add init you self service error code

func New

func New(code int, msg string) Error

New new error code and msg

func (Error) Code

func (e Error) Code() int

Code return error code

func (Error) Error

func (e Error) Error() string

func (Error) GRPCStatus added in v1.0.19

func (e Error) GRPCStatus() *status.Status

func (Error) Message

func (e Error) Message() string

Message return error message

Source Files

Jump to

Keyboard shortcuts

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