service/api/errs/error.go

66 lines
2.7 KiB
Go
Raw Normal View History

2023-12-21 22:17:40 +08:00
package errs
import (
"github.com/pkg/errors"
"service/api/errcode"
)
func DealVasErr(err error) (errcode.ErrCode, error) {
var (
ec = errcode.ErrCodeVasSrvOk
ok bool
)
if err != nil {
ec, ok = ErrEcMap[err]
err = errors.Wrap(err, "VasError")
if ok {
return ec, err
}
ec = errcode.ErrCodeVasSrvFail
return ec, err
}
return ec, err
}
var ErrEcMap = map[error]errcode.ErrCode{
ErrVasProductNotExists: errcode.ErrCodeProductNotExist,
ErrVasNotMoneyProduct: errcode.ErrCodeVasNotMoneyProduct,
ErrVasWalletNotExist: errcode.ErrCodeVasWalletNotExist,
ErrVasInvalidContactProduct: errcode.ErrCodeVasInvalidContactProduct,
ErrVasUserVasNotExist: errcode.ErrCodeVasUserVasNotExist,
ErrVasNoEnoughCoin: errcode.ErrCodeVasNoEnoughCoin,
ErrVasInvalidCoinPrice: errcode.ErrCodeVasInvalidCoinPrice,
ErrVasInvalidOrder: errcode.ErrCodeVasInvalidOrder,
ErrVasOrderNotMatch: errcode.ErrCodeVasOrderNotMatch,
ErrVasOrderNotExists: errcode.ErrCodeVasOrderNotExists,
ErrVasNotUnlock: errcode.ErrCodeVasNotUnlock,
ErrVasAlreadyUnlock: errcode.ErrCodeVasAlreadyUnlock,
ErrVasRepeatDeal: errcode.ErrCodeVasRepeatDeal,
ErrVasInvalidCalcPrice: errcode.ErrCodeVasInvalidCalcPrice,
ErrVasInvalidParam: errcode.ErrCodeVasInvalidParam,
2024-01-08 11:49:16 +08:00
ErrVasNoEnoughWithdrawDias: errcode.ErrCodeVasNoEnoughWithdrawDias,
ErrVasAlipayUniTransferFail: errcode.ErrCodeVasAlipayUniTransferFail,
2024-01-08 22:38:18 +08:00
ErrVasOverTodayWithdrawCnt: errcode.ErrCodeVasOverTodayWithdrawCnt,
2023-12-21 22:17:40 +08:00
}
var (
ErrVasProductNotExists = errors.New("vas product not exists")
ErrVasNotMoneyProduct = errors.New("not money product")
ErrVasWalletNotExist = errors.New("vas wallet not exists")
ErrVasInvalidContactProduct = errors.New("invalid contact product")
ErrVasUserVasNotExist = errors.New("user vas not exists")
ErrVasNoEnoughCoin = errors.New("no enough coin")
ErrVasInvalidCoinPrice = errors.New("invalid coin price")
ErrVasInvalidOrder = errors.New("invalid order")
ErrVasOrderNotMatch = errors.New("order not match")
ErrVasOrderNotExists = errors.New("order not exists")
ErrVasNotUnlock = errors.New("not unlock")
ErrVasAlreadyUnlock = errors.New("already unlock")
ErrVasRepeatDeal = errors.New("repeat deal")
ErrVasInvalidCalcPrice = errors.New("invalid calc price")
ErrVasInvalidParam = errors.New("invalid param")
2024-01-08 11:49:16 +08:00
ErrVasNoEnoughWithdrawDias = errors.New("no enough withdraw dias")
ErrVasAlipayUniTransferFail = errors.New("alipay uni transfer fail")
2024-01-08 22:38:18 +08:00
ErrVasOverTodayWithdrawCnt = errors.New("over today withdraw cnt")
2023-12-21 22:17:40 +08:00
)