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.