Adjust error string
This commit is contained in:
@@ -134,7 +134,7 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk
|
||||
}
|
||||
} else {
|
||||
// Issue #759 - we don't return error string for worries of non-determinism
|
||||
logError(ctx, "Redacting submessage error", err)
|
||||
moduleLogger(ctx).Info("Redacting submessage error", "cause", err)
|
||||
result = wasmvmtypes.SubcallResult{
|
||||
Err: redactError(err),
|
||||
}
|
||||
@@ -159,20 +159,13 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
func logError(ctx sdk.Context, msg string, err error) {
|
||||
logger := ctx.Logger()
|
||||
if logger != nil {
|
||||
logger.Info(msg, "error", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func redactError(err error) string {
|
||||
// FIXME: do we want to hardcode some constant string mappings here as well?
|
||||
// Or better document them? (SDK error string may change on a patch release to fix wording)
|
||||
// sdk/11 is out of gas
|
||||
// sdk/5 is insufficient funds (on bank send)
|
||||
codespace, code, _ := sdkerrors.ABCIInfo(err, false)
|
||||
return fmt.Sprintf("Error: %s/%d", codespace, code)
|
||||
return fmt.Sprintf("codespace: %s, code: %d", codespace, code)
|
||||
}
|
||||
|
||||
func filterEvents(events []sdk.Event) []sdk.Event {
|
||||
|
||||
Reference in New Issue
Block a user