joelonsql / wherr Goto Github PK
View Code? Open in Web Editor NEWEnhance Rust errors with file and line details using the `#[wherr]` macro for clearer debugging.
Home Page: https://crates.io/crates/wherr
License: Other
Enhance Rust errors with file and line details using the `#[wherr]` macro for clearer debugging.
Home Page: https://crates.io/crates/wherr
License: Other
Being able to work with the anyhow crate would make this crate much more ergonomic for use in existing code. Currently, wherr uses Box<dyn Error>
as it's inner error type and error returned from wherrapper. This is not Sized, Send, or Sync, meaning it cannot be converted into anyhow's Error type. Based on some testing I've done locally, the API of anyhow::Error is similar enough to that of Box that there would be nearly no code changes necessary between the two implementations.
I'd like to propose the existence of a feature flag which would switch wherr to use anyhow::Error as its inner error type. This could either change the behavior of the #[wherr] macro directly, or enable the existence of a #[wherr_anyhow] macro, whichever seems most convenient (though I lean toward the former).
If this is something you're interested in, I'd be happy to submit a PR implementing these changes.
Hi Joel,
I like wherr and would like to use it in our project. We are converting a C# project to rust. And one feature that we miss in rust is callstack for exception, which helps us to locate the issue. So I try to add something similar in this PR. Can you help review it?
Thanks,
Kai
If some users include your library with Anyhow, and some without it, a project including both such libraries will not build. You need to change your design so that the feature is additive, that is adding anyhow
shouldn't break code which relies on using std::error::Error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.