1 Star 0 Fork 0

dayphosphor/go-utils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
msg.go 628 Bytes
一键复制 编辑 原始数据 按行查看 历史
dayphosphor 提交于 2022-05-29 23:00 . errorx
package errorx
var msg map[int32]string
func init() {
msg = make(map[int32]string)
msg[ERRNO_OK] = "OK"
msg[ERRNO_PERM] = "无权限"
msg[ERRNO_INVAL] = "参数错误"
msg[ERRNO_BUSY] = "系统繁忙"
msg[ERRNO_NOTEXIST] = "结果不存在"
msg[ERRNO_INTERNAL] = "系统内部错误"
msg[ERRNO_TIMEOUT] = "请求超时"
msg[ERRNO_UNKNOWN] = "未知错误"
}
func MapErrMsg(code int32) string {
if msg, ok := msg[code]; ok {
return msg
} else {
return "服务器开小差啦,稍后再来试一试"
}
}
func IsCodeErr(code int32) bool {
if _, ok := msg[code]; ok {
return true
} else {
return false
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/dayphosphor/go-utils.git
git@gitee.com:dayphosphor/go-utils.git
dayphosphor
go-utils
go-utils
v0.0.8

搜索帮助

D67c1975 1850385 1daf7b77 1850385