On Fri, Jun 10, 2011 at 1:09 PM, Michael Schuerig
Poring over docs and headers, I noticed that neither boost::system::system_error nor boost::filesystem::filesystem_error are derived from boost::exception. Instead they implement an independent exception hierarchy.
I found this disconcerting. For one thing, I have to catch and handle the respective exceptions separately. Far more importantly, though, I was expecting consistency among boost libraries and now see that this is not the case apparently.
The reason for this discrepancy is that Boost Exception was added later than boost::filesystem and boost::system. With the introduction of Boost Exception, we now have a single base exception type for Boost libraries to use, but rather than modifying all existing Boost libraries, the boost::throw_exception function (which most Boost libraries have always been calling to throw exceptions) was modified so that the object it throws is guaranteed to derive from boost::exception. This is done at the point the throw_exception template is instantiated: if you pass it an object of type T which doesn't derive from boost::exception, it is wrapped in a type that derives both from T and from boost::exception (this mechanism is formally documented here: http://www.boost.org/doc/libs/release/libs/exception/doc/throw_exception.htm...) HTH, Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode