Coder Social home page Coder Social logo

joelonsql / wherr Goto Github PK

View Code? Open in Web Editor NEW
49.0 49.0 2.0 53 KB

Enhance Rust errors with file and line details using the `#[wherr]` macro for clearer debugging.

Home Page: https://crates.io/crates/wherr

License: Other

Rust 100.00%
rust-debugging rust-error rust-patterns

wherr's People

Contributors

joelonsql avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

wherr's Issues

Use of Box<dyn Error> prevents Wherr from working with anyhow

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.

Can you help review the PR to add backtrace?

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?

#3

Thanks,
Kai

`anyhow` feature not additive in the Wherr implementation

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.