
Tobias Schwinger <tschwinger <at> isonews2.com> writes:
Emil Dotchevski wrote:
I'm not keen on the use of operator<< to add the data to the exceptions.
I do share your concern, but consider that whatever we use for boost exception should support easy composition, because it needs to work when used in a throw expression directly:
throw my_error() << error_info<tag_errno>(errno) << error_info<tag_name>(name);
Instead of << we could use .add:
throw my_error(). add(error_info<tag_errno>(errno)). add(error_info<tag_name>(name));
This isn't bad, but in my opinion the << syntax is better despite my strong dislike for operator overloading.
Maybe a more or less obvious choice will do
throw my_error() = error_info<tag>(whatever), error_info<another_tag>(something_else) // ...
Why not use approach similar (if not based upon) named function parameters: throw my_error().data(( tag_errno = errno, tag_name = name, .... )) or for exception classes with trivial forwarding temaplte constructor throw my_error(( tag_errno = errno, tag_name = name, .... )) I also strongly in favor boost::optional instead of pointer result type. Gennadiy