add better director+exception support

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7038 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-03-07 20:47:55 +00:00
commit ca7159f7e7
9 changed files with 203 additions and 108 deletions

View file

@ -10,10 +10,6 @@
#ifdef __cplusplus
namespace Swig {
/* base class for director exceptions */
DirectorException::~DirectorException() {
}
/* simple thread abstraction for pthreads on win32 */
Director::~Director() {
swig_decref();
@ -27,6 +23,23 @@ namespace Swig {
bool Director::swig_mutex_active = false;
#endif
void UnknownExceptionHandler::handler() {
try {
throw;
} catch (DirectorException& e) {
std::cerr << "Swig Director exception caught: "<< e.getMessage() << std::endl;
} catch (std::exception& e) {
std::cerr << "std::exception caught: "<< e.what() << std::endl;
} catch (...) {
std::cerr << "Unknown exception caught." << std::endl;
}
std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl;
std::cerr << "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl;
std::cerr << "Now your program will probably be terminated, bye." << std::endl;
throw;
}
}
#endif /* __cplusplus */