Files
epusdt2/src/util/constant/errno.go
T

53 lines
1.3 KiB
Go

package constant
var Errno = map[int]string{
400: "system error",
401: "signature verification failed",
10001: "wallet address already exists",
10002: "order already exists",
10003: "no available wallet address",
10004: "invalid payment amount",
10005: "no available amount channel",
10006: "rate calculation failed",
10007: "block transaction already processed",
10008: "order does not exist",
10009: "failed to parse request params",
10010: "order status already changed",
}
var (
SystemErr = Err(400)
SignatureErr = Err(401)
WalletAddressAlreadyExists = Err(10001)
OrderAlreadyExists = Err(10002)
NotAvailableWalletAddress = Err(10003)
PayAmountErr = Err(10004)
NotAvailableAmountErr = Err(10005)
RateAmountErr = Err(10006)
OrderBlockAlreadyProcess = Err(10007)
OrderNotExists = Err(10008)
ParamsMarshalErr = Err(10009)
OrderStatusConflict = Err(10010)
)
type RspError struct {
Code int
Msg string
}
func (re *RspError) Error() string {
return re.Msg
}
func Err(code int) (err error) {
err = &RspError{
Code: code,
Msg: Errno[code],
}
return err
}
func (re *RspError) Render() (code int, msg string) {
return re.Code, re.Msg
}