1 Star 1 Fork 1

honwee/weetools

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
err.go 703 Bytes
一键复制 编辑 原始数据 按行查看 历史
chenhongwei 提交于 2021-12-01 13:49 +08:00 . feat: websocket接口封装
/**
* Copyright (C) 2021 UnionTech Software Technology Co., Ltd. All rights reserved.
* @author 陈弘唯
* @Email : chenhongwei@uniontech.com
* @date 2021/11/19 上午10:28
*/
package pkg
import (
"fmt"
)
type UbxErr struct {
Handler string
Msg string
}
func (e *UbxErr) Error() string {
return fmt.Sprintf("Func:[%s] happen Err:[%v]", e.Handler, e.Msg)
}
func (e *UbxErr) Attach(msg interface{}) *UbxErr {
switch msg.(type) {
case string:
return &UbxErr{
Msg: e.Msg + msg.(string),
}
default:
return &UbxErr{
Msg: e.Msg + fmt.Sprintf(" Value is [%+v]", msg),
}
}
}
func New(handler, msg string) *UbxErr {
return &UbxErr{
Handler: handler,
Msg: msg,
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/honwee/weetools.git
git@gitee.com:honwee/weetools.git
honwee
weetools
weetools
v1.0.8

搜索帮助