From: Christoph Krc (christoph.krc_at_[hidden])
Date: 2006-09-23 15:50:09
Since I try to merge some of my libraries into one with a common exception
concept I decided to use your exception library for it.
After adapting the most complex exceptions to your system I have some
suggestion to make:
1. Regarding the collission problem with a MS macro:
The name xinfo is in my opinion a bit to general.
Since english, as many european languages, borrows heavily from latin the
prefix "ex" is quite common.
And because xinfo is going to reside directly in the boost-namespace that
may cause problems.
Have you considered changing the info-part like exception_detail or
2. For some reason you have decided to prohibit copy assignment (the copy
assignment operator is private).
Since I can't see a good reason for it, in fact I expect an exception to be
assignable, I suggest you allow it.
3. I find myself writing a lot of wrapper function to retrieve the values
from the exception.
Since at the end eventually a message has to be displayed for the user I
have to assume that certain tags have been added to the exception.
So I try to get the tag-value and if it's not present replace it with a
Therefore I suggest a function like:
template <class Name,class T>
typename const exception_info_type<Name>::type&
get_exception_info1( T const & some_exception )
if (const exception_info_type<Name>::type* value =
boost::get_exception_info<Name>(some_exception)) return *value;
so you can define tags like:
struct tag_test : boost::exception_info_value<std::wstring>
static const value_type &GetDefaultValue()
const static std::wstring default_value(L"Unknown Value");
Of course "get_exception_info1" shouldn't be the name of the function.
Actually I think the current "get_exception_info" should be renamed to
"get_exception_info_ptr" and "get_exception_info1" should become
Maybe optionally an assertion can show up in debug mode to remind the
programmer that a tag is missing.
Generally I can say that adding new functionality to exception is quite easy
and repeated adding of common values can be nicely done in one function.
The drawback is that the throw statements can get rather long and it's not
possible to add a tag-value in the constructor.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk