exce

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: MIT Imports: 9 Imported by: 4

Documentation

Index

Constants

View Source
const (
	CodeOK = 0
)

Variables

View Source
var ErrString = map[DsgError]string{
	CodeOK: "ok",

	CodeSysBusy: "[error] 系统繁忙,请稍后重试",

	CodeUserError:   "[error] 用户类错误",
	CodeUserNoLogin: "[error] 请先登录",
	CodeUserNoAuth:  "[error] 抱歉,您的角色没有此功能的操作权限,请联系技术人员",

	CodeRequestError: "[error] 请求错误,请检查参数",
}

Functions

func DealException

func DealException(ctx iris.Context, err interface{})

func ExceptionCode

func ExceptionCode(ctx iris.Context, t interface{})

func ParseErr

func ParseErr(err error)

ParseErr 解析gPRC错误

func ThrowSys

func ThrowSys(err error, args ...interface{})

ThrowSys 抛出错误

func Write added in v0.2.0

func Write(data string)

Types

type DsgError added in v0.2.0

type DsgError int
const (
	CodeUserError DsgError = 2001 + iota
	CodeUserNoLogin
	CodeUserNoAuth
)

用户类

const (
	CodeRequestError DsgError = 3001 + iota
)
const (
	CodeSysBusy DsgError = 1001 + iota
)

func (DsgError) Code added in v0.2.0

func (d DsgError) Code() int

func (DsgError) Error added in v0.2.0

func (d DsgError) Error() string

type SysException

type SysException struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

Jump to

Keyboard shortcuts

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