Documentation ¶
Index ¶
- func CauseByLostConnection(err error) bool
- func F(ctx *gin.Context, err error)
- func H(code int, msg string, data interface{}) gin.H
- func LogErr(err error, mark string, isAlert bool)
- func LogErrWithGin(ctx *gin.Context, err error, isAlert bool)
- func S(ctx *gin.Context, data interface{})
- type CE
- type E
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CauseByLostConnection ¶
CauseByLostConnection 字符串匹配方式检查是否为断开连接导致出错
func LogErrWithGin ¶
LogErrWithGin 记录错误日志
Types ¶
type CE ¶
type CE int
CE 简单错误码错误
const ( SuccessCode = 0 UnknownError CE = -1 // 未知错误 // 基础服务错误 DbError CE = 100001 // 系统错误 RedisError CE = 100002 // 系统错误 LostConnectionError CE = 100003 // 系统错误 // 系统/服务错误 InvalidParams CE = 101001 // 请求参数错误 InvalidRequest CE = 101002 // 请求错误 SystemBusy CE = 101003 // 系统繁忙请稍后再试 DbRecordNotExist CE = 101004 // 数据不存在 ErrDefineWithMsg CE = 101005 // %s )
错误码定义:利用go工具链 generate 自动生成错误码映射map
-- 定义CE类型并通过注释给出对应文案
Click to show internal directories.
Click to hide internal directories.