error

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitErr

func InitErr(moduleSeq int32)

InitErr 统一注册服务模版号和错误码位数

Types

type Error

type Error struct {
	Code      int32  // 错误码
	Msg       string // 错误提示信息 (对外展示)
	DetailMsg string // 详细的错误提示信息 (服务内部使用)
}

Error 错误结构定义

func New

func New(code int32, msg string) *Error

New 初始化

func ToError

func ToError(err error) *Error

ToError error接口和Error转换

func (*Error) Error

func (e *Error) Error() string

Error() 实现error接口

func (*Error) GetCode

func (e *Error) GetCode() int32

GetCode 获取错误码

func (*Error) GetDetailMsg

func (e *Error) GetDetailMsg() string

GetDetailMsg 详细的错误提示信息 (服务内部使用)

func (*Error) GetMsg

func (e *Error) GetMsg() string

GetMsg 错误提示信息 (对外展示)

func (*Error) NewDetailMsg

func (e *Error) NewDetailMsg(detailMsg string) *Error

NewDetailMsg 设置详细的msg

func (*Error) NewMsg

func (e *Error) NewMsg(msg string) *Error

NewMsg 设置msg

func (*Error) ToString

func (e *Error) ToString() string

ToString 错误信息打印

Jump to

Keyboard shortcuts

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