2019-07-31 09:37:11 -07:00
|
|
|
package errors
|
|
|
|
|
|
|
|
import (
|
2019-12-27 09:57:54 -08:00
|
|
|
abci "github.com/tendermint/tendermint/abci/types"
|
2019-07-31 09:37:11 -07:00
|
|
|
)
|
|
|
|
|
2019-12-27 09:57:54 -08:00
|
|
|
// ResponseCheckTx returns an ABCI ResponseCheckTx object with fields filled in
|
|
|
|
// from the given error and gas values.
|
2020-07-05 09:56:17 -07:00
|
|
|
func ResponseCheckTx(err error, gw, gu uint64, debug bool) abci.ResponseCheckTx {
|
|
|
|
space, code, log := ABCIInfo(err, debug)
|
2019-12-27 09:57:54 -08:00
|
|
|
return abci.ResponseCheckTx{
|
|
|
|
Codespace: space,
|
|
|
|
Code: code,
|
|
|
|
Log: log,
|
|
|
|
GasWanted: int64(gw),
|
|
|
|
GasUsed: int64(gu),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ResponseDeliverTx returns an ABCI ResponseDeliverTx object with fields filled in
|
|
|
|
// from the given error and gas values.
|
2020-07-05 09:56:17 -07:00
|
|
|
func ResponseDeliverTx(err error, gw, gu uint64, debug bool) abci.ResponseDeliverTx {
|
|
|
|
space, code, log := ABCIInfo(err, debug)
|
2019-12-27 09:57:54 -08:00
|
|
|
return abci.ResponseDeliverTx{
|
|
|
|
Codespace: space,
|
|
|
|
Code: code,
|
|
|
|
Log: log,
|
|
|
|
GasWanted: int64(gw),
|
|
|
|
GasUsed: int64(gu),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// QueryResult returns a ResponseQuery from an error. It will try to parse ABCI
|
|
|
|
// info from the error.
|
2021-07-08 02:25:40 -07:00
|
|
|
func QueryResult(err error, debug bool) abci.ResponseQuery {
|
|
|
|
space, code, log := ABCIInfo(err, debug)
|
2019-12-27 09:57:54 -08:00
|
|
|
return abci.ResponseQuery{
|
|
|
|
Codespace: space,
|
|
|
|
Code: code,
|
|
|
|
Log: log,
|
|
|
|
}
|
|
|
|
}
|