[Home]User Exception - Program Options Suggestion

BOOST WIKI | RecentChanges | Preferences | Page List | Links List

No diff available--this is the first major revision. (no other diffs)

User exception

Back to Suggestions - program options library


A "user exception" should be supplied, which is under program_options_exception -- so that in your command-line processing code can be fully integrated, e.g.:

    try {
        ...
        if (badThing)
            throw program_options_user_exception("No good");
        ...

    } catch (exception& e) {
        if (dynamic_cast<program_options_exception*>(&e))
            cout << "Usage: " << ...;
    }

i.e. your error can get processed along with the logically-related program options errors.

    - People/Chuck Messenger


If you need user exception in some of your programs, I'd be happy to add it.

    - People/Vladimir Prus


Well, it seemed like it might be nice. But my main reason for wanting it was due to the lack of argument processing. That is, I'd want to process my arguments, raising a program_options exception when they were wrong. But if you unify argument processing (as per previous thread), then this need goes away.

So, really, this is just a workaround, which shouldn't be necessary. I'll just drop this request.

    - People/Chuck Messenger

BOOST WIKI | RecentChanges | Preferences | Page List | Links List
Edit text of this page | View other revisions
Last edited May 22, 2003 5:17 am (diff)
Search:
Disclaimer: This site not officially maintained by Boost Developers