On Sun, May 24, 2009 at 10:09 PM, Andrew Venikov
Emil Dotchevski wrote:
<...>
That's my point, you want some exceptions emitted by the throw expression to be ignored, and some not. <..>
I would rather say that the main exception should be thrown no matter what.
If you write: throw foo() << info1(bar()); and bar() throws something (note, this function might have nothing to do with Boost Exception or foo), do you want that exception silently ignored?
When I write this:
throw WidgetAllocError();
It's pretty obvious what I want. Of course, it would be nice to have more informative description, that's why I would normally add:
throw WidgetAllocError() << WidgetErrorDescription(strWidgetName);
But this now changes the original intent. By the time we reach the throw statement, we've made a decision that an error condition has been reached and we want to indicate that error. If we continue propagating WidgetAllocError(), then we'll at least know what kind of error happened, albeit without extra information.
That "albeit" is very important. It effectively requires the catch site to be able to deal with a WidgetAllocError that has no additional information in it. Are you sure you want to impose this requirement on all programs wrt all exceptions? Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode