cosmos-sdk/modules/fee/errors.go

40 lines
942 B
Go
Raw Normal View History

2017-07-06 02:30:03 -07:00
//nolint
2017-07-03 05:50:33 -07:00
package fee
import (
2017-07-12 10:06:55 -07:00
"fmt"
2017-07-03 05:50:33 -07:00
abci "github.com/tendermint/abci/types"
2017-07-03 05:50:33 -07:00
"github.com/tendermint/basecoin/errors"
)
var (
2017-07-18 22:23:13 -07:00
errInsufficientFees = fmt.Errorf("Insufficient fees")
errWrongFeeDenom = fmt.Errorf("Required fee denomination")
errSkipFees = fmt.Errorf("Skip fees")
2017-07-18 22:23:13 -07:00
invalidInput = abci.CodeType_BaseInvalidInput
2017-07-03 05:50:33 -07:00
)
func ErrInsufficientFees() errors.TMError {
2017-07-18 22:23:13 -07:00
return errors.WithCode(errInsufficientFees, invalidInput)
2017-07-03 05:50:33 -07:00
}
func IsInsufficientFeesErr(err error) bool {
return errors.IsSameError(errInsufficientFees, err)
}
func ErrWrongFeeDenom(denom string) errors.TMError {
2017-07-18 22:23:13 -07:00
return errors.WithMessage(denom, errWrongFeeDenom, invalidInput)
}
func IsWrongFeeDenomErr(err error) bool {
return errors.IsSameError(errWrongFeeDenom, err)
}
func ErrSkipFees() errors.TMError {
return errors.WithCode(errSkipFees, invalidInput)
}
func IsSkipFeesErr(err error) bool {
return errors.IsSameError(errSkipFees, err)
}