Stack traces in Result errors


I'd like to obtain a stacktrace from rust when something errors. So far I've come up with this gist, which is enough to highlight in our code where the error originated

Unfortunately this only works with nightly. Do you think it would be possible to port backtrace out into a separate crate so that it can be used from stable? Is there a better way to achieve the same goal?




Have you tried setting RUST_BACKTRACE=1 in the environment?

Hi Comex,

If I understand correctly, RUST_BACKTRACE=1 is for when a thread panics.
I'm interested in obtaining stack traces when there is an error in our
application (i.e. a function returns Err(blah))