|
Boost : |
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2006-11-07 14:57:51
This is an update to the proposed boost::exception library (the source code,
full documentation and tests are available at
http://www.revergestudios.com/boost-exception/boost-exception.htm.)
Last thing that I wanted to clear before requesting a formal boost review
for boost::exception is renaming exception_info as a workaround for the name
clash with the macro with the same name (lowercase and all) defined by
windows.h. The two candidates I like for renaming exception_info are:
except_info
throw_info
Here is an example of how they would look in code:
throw my_exception() <<
except_info<tag_errno>(errno) <<
except_info<tag_function>(BOOST_CURRENT_FUNCTION);
-or-
throw my_exception() <<
throw_info<tag_errno>(errno) <<
throw_info<tag_function>(BOOST_CURRENT_FUNCTION);
The above is a use case of encoding exception information at the time of the
throw. The other use case is to catch a boost::exception, add exception info
to it and re-throw. Here is an example of how each of except_info and
throw_info would look in that case:
catch( boost::exception & x )
{
x << except_info<tag_filename>(fn);
throw;
}
-or-
catch( boost::exception & x )
{
x << throw_info<tag_filename>(fn);
throw;
}
Any strong preferences?
Thanks,
Emil Dotchevski
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk