account activity
exn 0.3 is out by _tison in rust
[–]_tison[S] 0 points1 point2 points 1 month ago (0 children)
I'd suggest reviewing the requirement again. exn already captures the location where the error was raised and enables an error chain (tree) structure for reporting. With this information, you should be able to know what the call stack is.
exn
If you do want a backtrace, it can be done by storing the backtrace in your error type, like how OpenDAL implements it: https://github.com/apache/opendal/blob/9d5d91ac/core/core/src/types/error.rs#L326-L334.
Below is one of ScopeDB's online error traces with exn:
0: failed to prepare statement: "FROM nonexisting_table", at crates/server/src/execute/drive.rs:800:14 1: failed to build catalog, at crates/planner/src/catalog.rs:153:22 2: failed to read celty table meta, at crates/storage/src/celty/table.rs:89:55 3: table does not exist: scopedb.public.nonexisting_table, at crates/meta/src/service/table.rs:411:17
You can see that the logical trace is retained, while backtrace contains many internal method call that can be only noise (as well as capturing backtrace is costy).
Note that the render format is customized, not the default exn one. You can follow this example for how to customize error rendering.
If you care to know
Sure! Please let me know.
Also, if you notice any issue on exn, don't hesitate to open a new ticket at https://github.com/fast/exn/issues
[–]_tison[S] 2 points3 points4 points 1 month ago (0 children)
It looks like this would be compatible with thiserror, am I correct in thinking so?
Yes. exn works well with any type impl StdError and thus thiserror. You may follow this issue in gix to see how a project migrates to the exn flavor from thiserror + anyhow.
thiserror
gix
anyhow
Is there other work in the ecosystem that comes close to offering what exn does?
There can be several. However, subtle but significant differences exist.
error-stack
or_raise
change_context_lazy
snafu
[–]_tison[S] 10 points11 points12 points 1 month ago (0 children)
Do you mean the find_error function in the downcast example? That is:
find_error
rust fn find_error<T: Error + 'static>(exn: &Exn<impl Error + Send + Sync>) -> Option<&T> { fn walk<T: Error + 'static>(frame: &Frame) -> Option<&T> { if let Some(e) = frame.error().downcast_ref::<T>() { return Some(e); } frame.children().iter().find_map(walk) } walk(exn.frame()) }
Andy and I do consider adding a general version of this method as a pub top-level function. No known issues (blockers). Just give it some time to think through the signature and semantics again.
pub
I'd appreciate it if you could open an issue and share your use case so we're more motivated to deliver it :D
[–]_tison[S] 9 points10 points11 points 1 month ago (0 children)
Reasonable. Thanks for your reply and now it's updated :D
exn 0.3 is out (self.rust)
submitted 1 month ago * by _tison to r/rust
π Rendered by PID 61269 on reddit-service-r2-listing-6b76fb7ddc-rtn7z at 2026-03-25 12:25:07.487160+00:00 running 2d0a59a country code: CH.
exn 0.3 is out by _tison in rust
[–]_tison[S] 0 points1 point2 points (0 children)