elrond-wasm-rs icon indicating copy to clipboard operation
elrond-wasm-rs copied to clipboard

Query's errors not handled

Open gfusee opened this issue 1 year ago • 1 comments

When a query is a success from the HTTP's point of view (code 200), but a failure regarding the smart contract (code != 0), the sdk panics. This is not a wanted behavior since we cannot handle the errors easily, the only way to do so is by unwinding the stack which is a bad practice.

This error happens because the CommunicationProxy's execute_vmquery method try to parse the result to a ResponseVmValue, regardless if the query is a success or not.

To reproduce:

Query any smart contract with a random function to have the "invalid function" error

(I will likely do a PR soon to fix this)

gfusee avatar Nov 08 '23 15:11 gfusee