errcode

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Overview

通用错误码组件-通用模块代号000

通用错误码组件-错误消息相关接口

通用错误码组件-grpc错误返回定义

Index

Constants

View Source
const (
	SUCCESS                = 0
	FAIL                   = 10000000
	INVALID_PARAMS         = 10000001
	UNAUTH                 = 10000002
	NOT_FOUND              = 10000003
	DB_ERR                 = 10000004
	CACHE_ERR              = 10000005
	CREATE_FILE_FAIL       = 10000006
	SIGN_ERROR             = 10000007
	GRPC_SYS_ERR           = 10000008
	CONFIG_ERR             = 10000009
	UNKNOWN                = 10000010
	DEADLINE_EXCEEDED      = 10000011
	ACCESS_DENIED          = 10000012
	LIMIT_EXCEED           = 10000013
	METHOD_NOT_ALLOWED     = 10000014
	PARAMS_TELEPHONE_ERROR = 20000000
)

Variables

This section is empty.

Functions

func GetErrMsg

func GetErrMsg(code int) string

func RegisterErrMsgDict

func RegisterErrMsgDict(dict map[int]string)

func ToHttpStatusCode

func ToHttpStatusCode(code codes.Code) int

func ToRPCCode

func ToRPCCode(code int32) codes.Code

func TogRPCError

func TogRPCError(code int, msgs ...string) error

Types

type Status

type Status struct {
	*sts.Status
}

func FromError

func FromError(err error) *Status

func ToRPCStatus

func ToRPCStatus(code int, msgs ...string) *Status

func (*Status) CommonError

func (s *Status) CommonError() *common.Error

Jump to

Keyboard shortcuts

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