4 Star 10 Fork 2

Gitee 极速下载/go-ioc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/mylxsw/go-ioc
克隆/下载
error.go 1.37 KB
一键复制 编辑 原始数据 按行查看 历史
package ioc
import (
"errors"
"fmt"
)
var (
ErrObjectNotFound = errors.New("not found in container")
ErrArgsNotInstanced = errors.New("args not instanced")
ErrInvalidReturnValueCount = errors.New("invalid return value count")
ErrRepeatedBind = errors.New("repeated bind")
ErrInvalidArgs = errors.New("invalid args")
)
//func isErrorType(t reflect.Type) bool {
// return t.Implements(reflect.TypeOf((*error)(nil)).Elem())
//}
// buildObjectNotFoundError is an error object represent object not found
func buildObjectNotFoundError(msg string) error {
return fmt.Errorf("%w: %s", ErrObjectNotFound, msg)
}
// buildArgNotInstancedError is an error object represent arg not instanced
func buildArgNotInstancedError(msg string) error {
return fmt.Errorf("%w: %s", ErrArgsNotInstanced, msg)
}
// buildInvalidReturnValueCountError is an error object represent return values count not match
func buildInvalidReturnValueCountError(msg string) error {
return fmt.Errorf("%w: %s", ErrInvalidReturnValueCount, msg)
}
// buildRepeatedBindError is an error object represent bind a value repeated
func buildRepeatedBindError(msg string) error {
return fmt.Errorf("%w: %s", ErrRepeatedBind, msg)
}
// buildInvalidArgsError is an error object represent invalid args
func buildInvalidArgsError(msg string) error {
return fmt.Errorf("%w: %s", ErrInvalidArgs, msg)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors/go-ioc.git
git@gitee.com:mirrors/go-ioc.git
mirrors
go-ioc
go-ioc
master

搜索帮助