Great post. I do the same thing for all of my Rust web servers too. I don't use anyhow though, prefer rolling everything myself - which as you call out is a pain after a while.
would you get backtraces with this implementation? I've been increasingly frustrated with axum. It hits my custom error where I print something like "sqlx database failed" but when there's lots of traffic it's hard to determine which of the hundreds of queries actually failed. What I really want is the top part of a backtrace or at least a line number. I know anyhow gives bts but will it actually be useful when used like this?
we wrote some macro(with muncher) which allows strongly typed and yet dry per method error, error split of public part vs internal log only(with backtrace crate trace capture), full openapi support(via schemars) and we do not use anyhow.
goddtriffin|3 months ago
ruptwelve|3 months ago
vsgherzi|3 months ago
Anyone else have ideas on how to solve this?
dlahoda|3 months ago
we wrote some macro(with muncher) which allows strongly typed and yet dry per method error, error split of public part vs internal log only(with backtrace crate trace capture), full openapi support(via schemars) and we do not use anyhow.
whole article is rot and bad advice.
hobs|3 months ago
ruptwelve|3 months ago
robdahaldev|3 months ago
[deleted]