Stream: project-error-handling

Topic: Error Return Traces


view this post on Zulip BatmanAoD (Kyle Strand) (Oct 22 2020 at 15:24):

Zig has a very cool feature I just learned about:

https://ziglang.org/documentation/master/#Error-Return-Traces

The basic idea seems to be that the runtime automatically records every time a function returns an error, so that if the program exits with an error, the entire chain of "error events" can be printed, even if those errors were recovered from. (It may clear the record once a function returns without an error; I'm not sure.)

This is of course quite a bit of compiler magic, probably more than Rust can afford to add to all error types globally. But perhaps there's a way to achieve something similar in an opt-in way?

view this post on Zulip Jane Lusby (Oct 22 2020 at 15:25):

I wrote a pre rfc for this a while ago and it's already mentioned on the charter

view this post on Zulip Jane Lusby (Oct 22 2020 at 15:26):

https://paper.dropbox.com/doc/Collaborative-Summary-3-Fact-Finding-Pre-RFCs-around-Error-Handling-Reporting-dnShKo1SsHtdF4Yheeoco

view this post on Zulip Jane Lusby (Oct 22 2020 at 15:26):

but yea, I think we can definitely have error return traces in rust

view this post on Zulip BatmanAoD (Kyle Strand) (Oct 22 2020 at 15:27):

Oh! I must have glossed over that before. Nice.


Last updated: Jan 29 2022 at 09:51 UTC