Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not easy to get the exact error message from contract #191

Open
joshuajbouw opened this issue Sep 11, 2022 · 3 comments
Open

Not easy to get the exact error message from contract #191

joshuajbouw opened this issue Sep 11, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@joshuajbouw
Copy link
Member

I've been trying for the last while to get the fail result from the contract from ExecutionFailure. For ExecutionSuccess this is fine because I can return the json, borsh or raw_bytes quite easily. However, this isn't exceptionally straightforward on how to return the value field from ExecutionFailure! This would be an improvement if it is possible to return similar types as it is possible for successes.

@joshuajbouw joshuajbouw added the enhancement New feature or request label Sep 11, 2022
@ChaoticTempest
Copy link
Member

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.

@ghost
Copy link

ghost commented Nov 7, 2023

@frol Let's close this issue

@frol
Copy link
Collaborator

frol commented Nov 15, 2023

Well, contracts should have a proper standard for error handling that is easy to react from the client side code: near/near-sdk-rs#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: NEW❗
Development

No branches or pull requests

3 participants