rune-rs / rune

An embeddable dynamic programming language for Rust.
https://rune-rs.github.io
Apache License 2.0
1.76k stars 89 forks source link

How to get Rune backtraces for native Results at runtime? #811

Open VorpalBlade opened 2 months ago

VorpalBlade commented 2 months ago

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).

udoprog commented 2 months ago

A backtrace for the current vm could be extracted (stack frames) with the caveats that: