rs-soroban-env
rs-soroban-env copied to clipboard
Improve storage errors
When calling host.invoke_function()
, if a ledger entry is missing (e.g. due to a badly constructed contract invocation), the following error message is returned:
HostError: Error(Storage, MissingValue)
DebugInfo not available
(note that this is before invoking host.try_finish()
and thus there are no diagnostic events).
I would expect the error to tell me the key of the missing ledger entry. Also, (Storage, MissingValue)
isn't helpful since it doesn't tell the user it's a LedgerEntry which is missing.
In general, I think any errors returned by host.invoke_function()
before try_finish()
should be descriptive and add context, since there are no diagnostic events.
CC @dmkozh
I have seen that I can recover diagnostic events in try_finish()
even if invoke_function()
fails (which is awkward).
But even then, the diagnostic events are not useful.
Here's the XDR of the only event returned:
AAAAAAAAAAAAAAAAAAAAAgAAAAAAAAADAAAADwAAAAdmbl9jYWxsAAAAAA0AAAAgAQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAE=
Here's the unmarshalled event:
Hi @2opremio, Can you re-evaluate this with latest preview 11 build, please.
This can be closed since we are have lot of improved error handling. Please open a new issue if there are any other areas we can improve.