Skip to content

fix: preserve error types in WasmKeeper::execute#288

Open
gmanev7 wants to merge 2 commits intoCosmWasm:mainfrom
nolus-protocol:fix-execute-error-wrapping
Open

fix: preserve error types in WasmKeeper::execute#288
gmanev7 wants to merge 2 commits intoCosmWasm:mainfrom
nolus-protocol:fix-execute-error-wrapping

Conversation

@gmanev7
Copy link

@gmanev7 gmanev7 commented Mar 5, 2026

The map_err wrapper converted typed contract errors to a formatted string via StdError::msg(), irrevocably losing the concrete error type. This made downcast_ref::() always return None in tests.

Remove the wrapper so errors propagate directly from execute_wasm, preserving the original error type for downcasting in test assertions.

The map_err wrapper converted typed contract errors to a formatted
string via StdError::msg(), irrevocably losing the concrete error type.
This made downcast_ref::<ContractError>() always return None in tests.

Remove the wrapper so errors propagate directly from execute_wasm,
preserving the original error type for downcasting in test assertions.
@DariuszDepta
Copy link
Member

Hi @gmanev7!
Could you also add some test for this change?
Thanks in advance!

This updates test assertions to confirm the fix that errors are not being
re-wrapped in "Error executing WasmMsg". Also adds a dedicated
execute_error_is_not_wrapped test that explicitly documents this contract.
@gmanev7
Copy link
Author

gmanev7 commented Mar 5, 2026

Hi @DariuszDepta,

Yep, just pushed it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants