
Emil Dotchevski wrote:
Alternatively, you could use exception_ptr to store store the whole "low level" exception (error_infos and all) as an error_info:
struct exception_base: virtual boost::exception, virtual std::exception { }; struct lib_exception: exception_base { }; struct app_exception: exception_base { }; typedef boost::error_info
nested_exception; try { .... } catch( lib_exception & e ) { throw app_exception() << nested_exception(boost::current_exception()); }
(By the way, diagnostic_information will recurse into nested exceptions and print the nested error_infos as well.)
thank you for all the hints. Storing the original exception was
my biggest concern.
This feature of nested exceptions is very cool. It gets a little
bit lost in the documentation. I'd vote for providing that
typedef as a standard "boost::errinfo_...".
I attached a small change for diagnostic_information.
Unfortunately, I noticed that __cxa_demangle segfaults in certain
circumstances (at least on debian and ubuntu). Please forget
that function.
regards,
Denis
------------------------------------------------------------
--- diagnostic_information.hpp.org 2009-05-17 08:12:29.000000000 +0200
+++ diagnostic_information.hpp 2009-10-12 22:04:06.000000000 +0200
@@ -79,14 +79,11 @@
{
tmp << *f;
if( int const * l=get_error_info