#Diagnostic logs for panic_with_error

6 messages · Page 1 of 1 (latest)

mental swallow
#

A conversation occurred in the discord meeting today about why doesn't panic!("str") strings end up in the wasm.

I'm not sure this really address the original concern shared by @lost bear, but the conversation made me wonder if we could include more information in diagnostic logs other than just "error code 5" when contracts error.

At the very least we could write a contract log containing the name of the enum when panic_with_error is used, or when an error is returned. The SDK should be able to inject logs at both locations.

Potentially if there were doc comments on the enum value we could also log them.

Don't want to add this though if it wouldn't actually be useful.

#

We could inject the line number for the panic_with_error case, but not the return error case (I think).

#

For the return error case we could inject the function name that was called.

outer sentinel
#

I'm not really sure if the cost is worth it. though if that can be easily turned off for the final build, then it shouldn't matter

#

(I mean, we can't prohibit embedding whatever strings into contracts, but that will have cost implications for every invocation and storage costs)