1 Star 1 Fork 0

go-errors / errors

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
errors.go 682 Bytes
Copy Edit Raw Blame History
k3x authored 2021-06-04 01:36 . add errors.Wrap
package errors
import (
"golang.org/x/xerrors"
)
func New(text string) error {
return xerrors.New(text)
}
func Is(err, target error) bool {
return xerrors.Is(err, target)
}
func As(err, target error) bool {
if err == nil || target == nil {
return false
}
return xerrors.As(err, target)
}
func Unwrap(err error) error {
if err == nil {
return nil
}
return xerrors.Unwrap(err)
}
func Opaque(err error) error {
if err == nil {
return nil
}
return xerrors.Opaque(err)
}
func Errorf(format string, a ...interface{}) error {
return xerrors.Errorf(format, a...)
}
func Wrap(err error) error {
if err == nil {
return nil
}
return xerrors.Errorf("%w", err)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/go-errors/errors.git
git@gitee.com:go-errors/errors.git
go-errors
errors
errors
main

Search

344bd9b3 5694891 D2dac590 5694891