Boost logo

Boost :

From: Emil Dotchevski (emil_at_[hidden])
Date: 2007-10-03 14:28:53


> >> typedef tags<tag_file_name,tag_open_mode,tag_errno> file_err;
> >> throw my_error() << file_err(name,mode,errno);
>
> Looks good.
>
> I wonder why my_error() is required. I wonder if a globaly
> static object, such as "boost::exception()" might be even cleaner
> and more lightweight.

my_error is required so that you can catch my_error or other_error or
something else.

This is why I overreacted perhaps when Tobias said that
boost::exception wants to be THE exception class. I feel very strongly
that different failures should be reported by throwing exceptions of
different types.

Moreover, boost::exception makes it especially easy to classify your
exception types because all of them can be empty structs; the only
design the user has to come up with is a hierarchy.

Emil Dotchevski


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