Open joshuajbouw opened 2 years ago
The value: TxExecutionError
field for ExecutionFailure
is meant to be hidden as we do not want to expose it as a transient dependency. There's no direct methods to usually interact with it unless you require something from it? It doesn't return bytes, so there's nothing to be operated on it like you'd do with json
/borsh
in the case of successful execution. It's moreso an opaque error type, and not meant to be directly handled besides just for debugging purposes; in which case you can format!
it to get the error message.
@frol Let's close this issue
Well, contracts should have a proper standard for error handling that is easy to react from the client side code: https://github.com/near/near-sdk-rs/issues/936. I will keep this issue open and will try to push something from near-sdk-rs side first and then we can resolve this issue here as well. Meanwhile .to_string()
is the only way to get the error.
I've been trying for the last while to get the fail result from the contract from
ExecutionFailure
. ForExecutionSuccess
this is fine because I can return thejson
,borsh
orraw_bytes
quite easily. However, this isn't exceptionally straightforward on how to return thevalue
field fromExecutionFailure
! This would be an improvement if it is possible to return similar types as it is possible for successes.