bizerr

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCodeInternal // internal error
)

define utils error code

View Source
const (
	ErrCodeModuleRoot = ErrCodeStart * (1 + iota)
)

ErrCodeModuleRoot define error code module, e,g: 10000, 20000, 30000...

View Source
const ErrCodeStart = 10000

ErrCodeStart 业务逻辑错误代码起始值 选择10000作为起始值是为了与系统错误码(1-999)和HTTP状态码(100-599)区分 业务模块错误码按万进制划分:10000=基础模块,20000=用户模块,30000=订单模块等

Variables

This section is empty.

Functions

func ToGrpcError

func ToGrpcError(err error) error

Types

type Error

type Error interface {
	error
	Code() int
}

func FromGrpcError

func FromGrpcError(err error) Error

FromGrpcError 从grpc status error获取额外的错误信息

func InternalError

func InternalError(message string) Error

func New

func New[T constraints.Integer](code T, message string) Error

New error with error code

Jump to

Keyboard shortcuts

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