errors

package
v0.0.0-...-1acf2d3 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ldate = 1 << iota
	Ltime
	Lmicroseconds
	Llongfile
	Lshortfile
	LUTC
	LstdFlags = Ldate | Ltime

	MaxOutput = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseErrMsg

type BaseErrMsg struct {
	ErrMsg   string `json:"err_msg"`
	ErrMsgEn string `json:"err_msg_en"`
}

type CustomErrMsg

type CustomErrMsg BaseErrMsg

type ErrCode

type ErrCode int
const (
	ErrSuccess ErrCode = iota
	ErrUnknownError
	ErrUnstableNetwork
	ErrPermissionDeny
	ErrServiceUnderMaintaining
	ErrTooMuchRequest
	ErrServiceNotFound

	ErrNeedLogin    ErrCode = 40100
	ErrTokenExpired ErrCode = 41101
)

type Error

type Error struct {
	ErrCode ErrCode `json:"err_code"`
	// The message of the error.
	ErrMsg string `json:"err_msg"`
	// The message of the error.
	ErrMsgEn string `json:"err_msg_en"`
}

Error holds the error message, this message never really changes

func New

func New(errCode ErrCode, errMsg ...CustomErrMsg) Error

New creates and returns an Error with a pre-defined user output message

func NewFormat

func NewFormat(errCode ErrCode, errMsg ...interface{}) Error

func (Error) Error

func (e Error) Error() string

func (Error) Marshal

func (e Error) Marshal() []byte

func (Error) MarshalString

func (e Error) MarshalString() string

Jump to

Keyboard shortcuts

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