herrors

package
v1.1.44 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ECodeOK      = 0
	ECodeUnknown = -1 //未知错误编码

	// 服务器错误代码
	ECodeSysInternal  = 101 //服务器内部错误
	ECodeSysBusy      = 102 //服务器忙
	ECodeSysUnhandled = 103 //未处理. 这种报错多用于父类向子类返回,以便子类继续处理,

	// 调用方错误代码
	ECodeCallerInvalidRequest     = 201 //无效请求
	ECodeCallerUnauthorizedAccess = 202 //非法请求

	// 用户端错误
	ECodeUserInvalidAct      = 301 // 无效用户行为
	ECodeUserUnauthorizedAct = 302 // 非法用户行为
)

Variables

View Source
var (
	ErrOK = New(ECodeOK)

	// Backend errors
	ErrSysInternal  = New(ECodeSysInternal)
	ErrSysBusy      = New(ECodeSysBusy)
	ErrSysUnhandled = New(ECodeSysUnhandled)

	// Caller errors
	ErrCallerInvalidRequest     = New(ECodeCallerInvalidRequest)
	ErrCallerUnauthorizedAccess = New(ECodeCallerUnauthorizedAccess)

	// User errors
	ErrUserInvalidAct      = New(ECodeUserInvalidAct)
	ErrUserUnauthorizedAct = New(ECodeUserUnauthorizedAct)
)

Functions

func QueryFingerprint

func QueryFingerprint(fp string) string

func StaticsFingerprint

func StaticsFingerprint() string

Types

type Error

type Error struct {
	Code        int    `json:"code"`
	Desc        string `json:"desc"`
	Fingerprint string `json:"fingerprint,omitempty"`
	Cause       string `json:"cause"`
	// contains filtered or unexported fields
}

func New

func New(code int) *Error

func (*Error) D

func (this *Error) D(format string, v ...interface{}) *Error

func (*Error) Equal

func (this *Error) Equal(err *Error) bool

func (*Error) Error

func (this *Error) Error() string

func (*Error) New

func (this *Error) New(format string, v ...interface{}) *Error

Jump to

Keyboard shortcuts

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