err.go 740 字节
package xerr

/**默认的服务错误**/

func NewErr(err error) *CodeError {
	return &CodeError{errCode: ServerCommonError, InternalError: err}
}

func NewErrMsg(errMsg string) *CodeError {
	return &CodeError{errCode: ServerCommonError, errMsg: errMsg}
}

func NewErrMsgErr(errMsg string, internalError error) *CodeError {
	return &CodeError{errCode: ServerCommonError, errMsg: errMsg, InternalError: internalError}
}

/**指定错误码的错误**/

func NewCodeErr(errCode uint32, err error) *CodeError {
	return &CodeError{errCode: errCode, errMsg: MapErrMsg(errCode), InternalError: err}
}

func NewCodeErrMsg(errCode uint32, err error, msg string) *CodeError {
	return &CodeError{errCode: errCode, errMsg: msg, InternalError: err}
}