-
Notifications
You must be signed in to change notification settings - Fork 76
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
Ununderstandable return data when panic #1253
Comments
What contract is this? Stellar Asset Contract? My guess is that the issue here is that the code has |
This issue occurs in every contract that utilizes the panic! macro. Even in a basic "hello world" contract, invoking panic! will produce the same output. |
Well from a CLI perspective there isn't much to be done about the use of Either way it is always better to use a |
Digging deeper, this is the reason, the panic handler uses |
This is a limitation of panic! and not something the CLI could change. The rs-soroban-sdk and rs-soroban-env could be changed to capture and log the string, but it doesn't do that today. Recommend looking at the errors tutorial which shows how to create an error type and return errors from the contract, or panic with errors: |
What version are you using?
Soroban 20.3.0
What did you do?
When invoking a contract in a local node using the soroban CLI with a command similar to:
soroban contract invoke --id $ContractId --source alice --network standalone -- $FunctionName
And if the invoked function contains a panic statement for a specific condition, such as:
panic!("cannot swap token to same one")
And you intentionally trigger that condition to observe the error returned from the function, you might expect to receive an error message that explains what occurred during the function invocation.
What did you expect to see?
The expected output should be: "cannot swap token to same one", providing clarity about the issue encountered during the function execution. This information would help in understanding the cause of the error.
What did you see instead?
With this output, I'm not able to know what is the problem that triggered the panic
The text was updated successfully, but these errors were encountered: