Versions in this module Expand all Collapse all v0 v0.1.1 Apr 1, 2026 Changes in this version + var As = gError.As + var Cause = errors.Cause + var ErrBadRequest = New400Response(400, "请求发生错误") + var ErrInternalServer = NewResponse(500, 500, nil, "服务器发生错误") + var ErrInvalidParent = New400Response(400, "无效的父级节点") + var ErrInvalidPassword = New400Response(400, "无效的密码") + var ErrInvalidToken = NewResponse(401, 401, nil, "令牌失效") + var ErrInvalidUser = New400Response(400, "无效的用户") + var ErrInvalidUserName = New400Response(400, "无效的用户名") + var ErrMethodNotAllow = NewResponse(405, 405, nil, "方法不被允许") + var ErrNoPerm = NewResponse(401, 401, nil, "无访问权限") + var ErrNotAllowDelete = New400Response(400, "资源不允许删除") + var ErrNotAllowDeleteWithChild = New400Response(400, "含有子级,不能删除") + var ErrNotFound = WrapResponseWithField(fmt.Errorf("资源不存在"), 400, "", 100030002, nil, "资源不存在") + var ErrNotToken = NewResponse(401, 401, nil, "未找到令牌") + var ErrTooManyRequests = NewResponse(429, 429, nil, "请求过于频繁") + var ErrUserDisable = New400Response(400, "用户被禁用,请联系管理员") + var Errorf = errors.Errorf + var Is = errors.Is + var New = errors.New + var Unwrap = errors.Unwrap + var WithMessage = errors.WithMessage + var WithMessagef = errors.WithMessagef + var WithStack = errors.WithStack + var Wrap = errors.Wrap + var Wrapf = errors.Wrapf + func New400ErrResponse(code int, data interface{}, msg string, args ...interface{}) error + func New400ErrResponseWithField(field string, code int, data interface{}, msg string, args ...interface{}) error + func New400Response(code int, msg string, args ...interface{}) error + func New400ResponseWithField(field string, code int, msg string, args ...interface{}) error + func New500Error(code int, data interface{}) error + func New500Response(msg string, args ...interface{}) error + func NewError(code int, err error) error + func NewErrorMsg(code int, err error, msg string, args ...interface{}) error + func NewMsg(code int, msg string, args ...interface{}) error + func NewResError(err error) error + func NewResErrorMsg(err error, msg string, a ...any) error + func NewResponse(statusCode, code int, data interface{}, msg string, args ...interface{}) error + func NewResponseWithField(statusCode int, field string, code int, data interface{}, msg string, ...) error + func Wrap400Err(err error, code int) error + func Wrap400ErrResponse(err error, code int, data interface{}, msg string, args ...interface{}) error + func Wrap400ErrWithField(err error, field string, code int) error + func Wrap400Response(err error, code int, msg string, args ...interface{}) error + func Wrap400ResponseWithField(err error, field string, code int, data interface{}, msg string, ...) error + func Wrap500Response(err error, msg string, args ...interface{}) error + func WrapField(err error, field string) error + func WrapResponse(err error, statusCode, code int, data interface{}, msg string, ...) error + func WrapResponseWithField(err error, statusCode int, field string, code int, data interface{}, ...) error + type ResponseError struct + Code int + Data interface{} + ERR error + Field string + Message string + StatusCode int + func UnWrapResponse(err error) *ResponseError + func (r *ResponseError) Cause() error + func (r *ResponseError) Error() string + func (r *ResponseError) Unwrap() error