rune
rune copied to clipboard
How to get Rune backtraces for native Results at runtime?
trafficstars
When Rune's Vm::async_call returns a VmError you can get a nice backtrace using VmError::emit. However if you return custom Result<T, CustomError> from your native methods it doesn't seem there is a way to capture the Rune backtrace as far as I can tell?
I could consider sticking the backtrace in my custom error type if I knew how to capture it when returning from my native code for example.
This is either a request for a feature or request for improved documentation (the latter I would be willing to PR if you point me in the right direction).
A backtrace for the current vm could be extracted (stack frames) with the caveats that:
- It would require a dedicated instruction to extract. " It would not be able to peek through native functions, futures, and generators (vm execution stuff).
- It would only provide rich diagnostics if debug info is available.