Boost logo

Boost :

From: Jeremy Day (jeremy.day_at_[hidden])
Date: 2006-07-21 08:31:01


On 7/20/06, Oleg Abrosimov <beholder_at_[hidden]> wrote:
>
> //in application_exception_handler.hpp
> struct my_exception_handler
> {
> void operator()(std::string& sError); //Note here
> void operator()(std::exception& oError);
> void operator()(std::logic_error& oError);
> void operator()(void);
> };
>
> //in application.cpp
> typedef boost::mpl::vector<std::logic_error, std::exception> exceptions;
> //Note here
>
> int main()
> try {
> throw std::logic_error("testing");
> } catch(...) {
> catcher<exceptions>(my_exception_handler()); //Note here
> }
>
> with this transformation one can use one my_exception_handler class with
> many reduced exceptions typelists. It also eliminates the duplication
> problem. Duplication still exists but is intensional.

I have considered doing that, but I haven't yet had the time to actually get
it done. I would like to use a provided exception list and, if one is not
provided, look for a nested exceptions type.

By the way, I don't know if I have said this yet or not, but one of my
primary motivations for tinkering around with this in the first place is
sheer laziness. I don't like to write more than one catch block if I can
absolutely help it.

Jeremy


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk