rs-soroban-env icon indicating copy to clipboard operation
rs-soroban-env copied to clipboard

Improve storage errors

Open 2opremio opened this issue 1 year ago • 4 comments

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.

2opremio avatar Aug 21 '23 00:08 2opremio

CC @dmkozh

2opremio avatar Aug 21 '23 00:08 2opremio

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=

2opremio avatar Aug 21 '23 01:08 2opremio

Here's the unmarshalled event:

Screenshot 2023-08-21 at 03 07 04

2opremio avatar Aug 21 '23 01:08 2opremio

Hi @2opremio, Can you re-evaluate this with latest preview 11 build, please.

anupsdf avatar Sep 12 '23 22:09 anupsdf

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.

anupsdf avatar Jun 17 '24 21:06 anupsdf