Skip to content

Commit a99e15c

Browse files
committed
Fix the post handler response code thing.
1 parent bc9377e commit a99e15c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

baseapp/baseapp.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,13 @@ func (app *BaseApp) runTxProv(mode execMode, txBytes []byte) (gInfo sdk.GasInfo,
982982

983983
newCtx, errPostHandler := app.postHandler(postCtx, tx, mode == execModeSimulate, err == nil)
984984
if errPostHandler != nil {
985-
return gInfo, nil, anteEvents, ctx, errors.Join(err, errPostHandler)
985+
// The result of errors.Join breaks the response code stuff, resulting in code 1 (logic error) always.
986+
// So if there was also an error running the msgs, we'll use the error code from that, but include
987+
// the post handler error too. Otherwise, we just return the post handler error.
988+
if err != nil {
989+
errPostHandler = errorsmod.Wrap(err, errPostHandler.Error())
990+
}
991+
return gInfo, nil, anteEvents, ctx, errPostHandler
986992
}
987993

988994
// we don't want runTx to panic if runMsgs has failed earlier

0 commit comments

Comments
 (0)