cerrors

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2022 License: MulanPSL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorCodeList = map[string]Errors{
	"parameter_error":     {4000000, "参数错误[ %s ]"},
	"unauthorized_access": {4000001, "未授权访问"},
	"forbidden_access":    {4000003, "禁止访问"},

	"internal_service_error":   {5000000, "服务内部错误"},
	"server_unavailable_error": {5000003, "服务暂不可用"},
	"api_undefined_error":      {5000101, "未定义错误[ %s ]"},
}

Functions

func Error

func Error(key string) error

func Errorf

func Errorf(key string, msg interface{}) error

Types

type Errors

type Errors struct {
	Code    int    `json:"code" example:"4000000"`
	Message string `json:"message"`
}

func (*Errors) Error

func (e *Errors) Error() string

func (*Errors) GetCode

func (e *Errors) GetCode() int

func (*Errors) GetMessage

func (e *Errors) GetMessage() string

func (*Errors) SetCode

func (e *Errors) SetCode(code int)

func (*Errors) SetMessage

func (e *Errors) SetMessage(message string)

Jump to

Keyboard shortcuts

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