error2

package
v0.0.0-...-c4618b4 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Unknown 未知错误
	Unknown = -1
	// Internal 内部错误
	Internal = -2

	// Success 成功
	Success = 0

	// ErrParams 参数错误
	ErrParams = 1
)

10[模块代码] 4XX[状态码] 1000[错误码]

Variables

View Source
var CodeTable map[int64]string

CodeTable 码表

Functions

func Translation

func Translation(code int64) string

Translation translation code to message

Types

type Error

type Error struct {
	Code    int64
	Message string
}

Error 错误处理封装

func NewError

func NewError(code int64, params ...interface{}) Error

NewError 创建一个错误

func NewErrorWithString

func NewErrorWithString(code int64, message string) Error

NewErrorWithString 创建一个错误

func (Error) Error

func (e Error) Error() string

Jump to

Keyboard shortcuts

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