chore: move abci errors to baseapp (#20756)

This commit is contained in:
Marko
2024-06-25 10:04:33 +00:00
committed by GitHub
parent 340f85f512
commit aceeaf4720
4 changed files with 26 additions and 25 deletions
-46
View File
@@ -1,46 +0,0 @@
package errors
import (
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
errorsmod "cosmossdk.io/errors"
)
// ResponseCheckTxWithEvents returns an ABCI ResponseCheckTx object with fields filled in
// from the given error, gas values and events.
func ResponseCheckTxWithEvents(err error, gw, gu uint64, events []abci.Event, debug bool) *abci.CheckTxResponse {
space, code, log := errorsmod.ABCIInfo(err, debug)
return &abci.CheckTxResponse{
Codespace: space,
Code: code,
Log: log,
GasWanted: int64(gw),
GasUsed: int64(gu),
Events: events,
}
}
// ResponseExecTxResultWithEvents returns an ABCI ExecTxResult object with fields
// filled in from the given error, gas values and events.
func ResponseExecTxResultWithEvents(err error, gw, gu uint64, events []abci.Event, debug bool) *abci.ExecTxResult {
space, code, log := errorsmod.ABCIInfo(err, debug)
return &abci.ExecTxResult{
Codespace: space,
Code: code,
Log: log,
GasWanted: int64(gw),
GasUsed: int64(gu),
Events: events,
}
}
// QueryResult returns a ResponseQuery from an error. It will try to parse ABCI
// info from the error.
func QueryResult(err error, debug bool) *abci.QueryResponse {
space, code, log := errorsmod.ABCIInfo(err, debug)
return &abci.QueryResponse{
Codespace: space,
Code: code,
Log: log,
}
}