1 Star 0 Fork 0

sy_183 / go-common

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
not-found.go 458 Bytes
一键复制 编辑 原始数据 按行查看 历史
sy_183 提交于 2023-05-29 17:41 . 1. 修改了错误处理相关结构
package errors
import "fmt"
type NotFound struct {
Target any
}
func NewNotFound(target any) NotFound {
return NotFound{Target: target}
}
func (e NotFound) Error() string {
switch re := e.Target.(type) {
case error:
return fmt.Sprintf("[%s]未找到", re.Error())
case string:
return fmt.Sprintf("[%s]未找到", re)
case fmt.Stringer:
return fmt.Sprintf("[%s]未找到", re.String())
default:
return fmt.Sprintf("[%v]未找到", re)
}
}
1
https://gitee.com/sy_183/go-common.git
git@gitee.com:sy_183/go-common.git
sy_183
go-common
go-common
v1.0.4

搜索帮助

53164aa7 5694891 3bd8fe86 5694891