Giter Site home page Giter Site logo

Comments (6)

Arnavion avatar Arnavion commented on June 22, 2024

What I said here is still mostly true. Compared to the error_chain! macro, here the user needs to declare an enum, remember to mark it pub, remember to derive Debug, and remember to provide a Msg(String) member. Then for each variant, instead of nice function syntax for display and description they have to make a separate function or embed it in a string.

You can see an example at https://github.com/Arnavion/fac-rs/blob/2a8f67bb/factorio-mods-local/src/error.rs That repo is probably the only bunch of crates that use it. I've not heard of anyone else using it nor received any feedback.

The error_chain! macro has its place for convenience. I would never go as far as replacing it entirely. At best this can function as a (currently experimental) alternative.

from derive-error-chain.

Yamakaky avatar Yamakaky commented on June 22, 2024

I'm thinking: can't we modify error_chain! to use derive-error-chain in the background? That way we would have more code in common.

from derive-error-chain.

Arnavion avatar Arnavion commented on June 22, 2024

It might be possible.

from derive-error-chain.

Yamakaky avatar Yamakaky commented on June 22, 2024

What do you think @brson?

from derive-error-chain.

Arnavion avatar Arnavion commented on June 22, 2024

(I should clarify that I think it might be possible, not that it's a good idea. It seems unnecessarily roundabout for a regular macro to generate input for another proc macro.)

from derive-error-chain.

Arnavion avatar Arnavion commented on June 22, 2024

An update to my earlier sentiments, based on the last few months:

That repo [Arnavion/fac-rs] is probably the only bunch of crates that use it. I've not heard of anyone else using it nor received any feedback.

This is no longer true since atleast dotenv uses it, and one user has submitted a PR to add support for generic errorkinds.

The error_chain! macro has its place for convenience. I would never go as far as replacing it entirely.

However upstream is considering replacing it entirely. rust-lang-deprecated/error-chain#170

At best this can function as a (currently experimental) alternative.

I don't consider this crate experimental any more.

from derive-error-chain.

Related Issues (20)

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.