github.com/mydexchain/tendermint@v0.0.4/mempool/errors.go (about) 1 package mempool 2 3 import ( 4 "errors" 5 "fmt" 6 ) 7 8 var ( 9 // ErrTxInCache is returned to the client if we saw tx earlier 10 ErrTxInCache = errors.New("tx already exists in cache") 11 ) 12 13 // ErrTxTooLarge means the tx is too big to be sent in a message to other peers 14 type ErrTxTooLarge struct { 15 max int 16 actual int 17 } 18 19 func (e ErrTxTooLarge) Error() string { 20 return fmt.Sprintf("Tx too large. Max size is %d, but got %d", e.max, e.actual) 21 } 22 23 // ErrMempoolIsFull means Tendermint & an application can't handle that much load 24 type ErrMempoolIsFull struct { 25 numTxs int 26 maxTxs int 27 28 txsBytes int64 29 maxTxsBytes int64 30 } 31 32 func (e ErrMempoolIsFull) Error() string { 33 return fmt.Sprintf( 34 "mempool is full: number of txs %d (max: %d), total txs bytes %d (max: %d)", 35 e.numTxs, e.maxTxs, 36 e.txsBytes, e.maxTxsBytes) 37 } 38 39 // ErrPreCheck is returned when tx is too big 40 type ErrPreCheck struct { 41 Reason error 42 } 43 44 func (e ErrPreCheck) Error() string { 45 return e.Reason.Error() 46 } 47 48 // IsPreCheckError returns true if err is due to pre check failure. 49 func IsPreCheckError(err error) bool { 50 _, ok := err.(ErrPreCheck) 51 return ok 52 }