Stack traces in Result errors


#1

Hello!,

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?

Thanks,

Phil


#2

Have you tried setting RUST_BACKTRACE=1 in the environment?


#3

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