Git Product home page Git Product logo

Comments (5)

lambdafu avatar lambdafu commented on August 19, 2024

It's smarter to keep RuntimeError and ParseError siblings, so that's what I did in #45.

from cli11.

henryiii avatar henryiii commented on August 19, 2024

Two initial thoughts:

  • This really makes CLI11_PARSE the recommended/required way to exit. For someone not using CLI11_PARSE, you should be able to do:
try {
    app.parse(argc, argv);
} catch (const CLI::Error &e) {
    return app.exit(e);
}

(I'm okay if CLI::ParseError isn't enough)

  • It might make sense to move CLI::Success to a CLI::RuntimeError too. No, I think it works fine as is.

I'll probably push to the PR in a minute.

from cli11.

lambdafu avatar lambdafu commented on August 19, 2024

That's ok. I was worried that catching CLI::Error is too grabby, because the other errors are more like programming errors (such as adding options twice), which I thought CLI11_PARSE doesn't catch purposefully. Thanks!

from cli11.

henryiii avatar henryiii commented on August 19, 2024

The other errors cannot be thrown from .parse, though sometimes users wrap too much in the try block. I think leaving CLI11_PARSE as less grabby is a good idea, but direct usage should be at least possible catching CLI::Error.

from cli11.

henryiii avatar henryiii commented on August 19, 2024

I've made RuntimeError a ParseError, since it can only happen at parse time, and will leave the Error catching as ParseError catching. This has the smallest API change.

from cli11.

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.