> I've encountered a problem with exceptions in boost/test:
> Our project uses a base class for all our exceptions which 
> cannot derive 
> from std::exception.
> 
> If such an exception is thrown, the message:
>         Exception in "...": unknown type
> is printed out, which is not very helpful in locating the problem.
> 
> Is there a way to specify an "exception handler", which can 
> catch "our" 
> exceptions and print something more useful?.

I could do something along following lines:

#include <iostream>
using namespace std;

void
unknown_exception_handler()
{
    try {
        throw;
    }
    catch( int i ) {
        cout << "int caught\n";
    }
}


int main()
{
    try  {
        throw 1;
    }
    catch( ... ) {
        try {
            unknown_exception_handler();
        } catch( ... ) {
            cout << "unknown exception\n";
        }
    }
}

and provide a way to configure unknown_exception_handler.
Dave, do you have something different in mind?

Gennadiy.
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to