Replace std::unexpected_handler with std::terminate_handler to be c++17 compliant

Closes #1538
This commit is contained in:
William S Fulton 2019-06-07 19:55:15 +01:00
commit 5c1c69d140
2 changed files with 10 additions and 11 deletions

View file

@ -219,7 +219,7 @@ namespace Swig {
PyErr_Print();
std::cerr << std::endl;
std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl
std::cerr << "This exception was caught by the SWIG UnknownExceptionHandler." << std::endl
<< "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl
<< std::endl
<< "Exception is being re-thrown, program will likely abort/terminate." << std::endl;
@ -227,14 +227,13 @@ namespace Swig {
}
public:
std::unexpected_handler old;
UnknownExceptionHandler(std::unexpected_handler nh = handler) {
old = std::set_unexpected(nh);
std::terminate_handler old;
UnknownExceptionHandler(std::terminate_handler nh = handler) {
old = std::set_terminate(nh);
}
~UnknownExceptionHandler() {
std::set_unexpected(old);
std::set_terminate(old);
}
#endif
};

View file

@ -170,7 +170,7 @@ namespace Swig {
std::cerr << std::endl
<< "Ruby interpreter traceback:" << std::endl;
std::cerr << std::endl;
std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl
std::cerr << "This exception was caught by the SWIG UnknownExceptionHandler." << std::endl
<< "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl
<< std::endl
<< "Exception is being re-thrown, program will like abort/terminate." << std::endl;
@ -178,13 +178,13 @@ namespace Swig {
}
public:
std::unexpected_handler old;
UnknownExceptionHandler(std::unexpected_handler nh = handler) {
old = std::set_unexpected(nh);
std::terminate_handler old;
UnknownExceptionHandler(std::terminate_handler nh = handler) {
old = std::set_terminate(nh);
}
~UnknownExceptionHandler() {
std::set_unexpected(old);
std::set_terminate(old);
}
#endif
};