Remove the UnknownExceptionHandler director error handling class

Done in order to be C++17 compliant as it uses std::unexpected_handler
which was removed in C++17. This class was intended for director
exception handling but was never used by SWIG and was never documented.

Closes #1538
This commit is contained in:
William S Fulton 2019-06-24 08:37:29 +01:00
commit b655d3138b
3 changed files with 8 additions and 76 deletions

View file

@ -7,6 +7,14 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.0.1 (in progress)
===========================
2019-06-24: wsfulton
[Python, Ruby] #1538 Remove the UnknownExceptionHandler class in order to be
C++17 compliant as it uses std::unexpected_handler which was removed in C++17.
This class was intended for director exception handling but was never used by
SWIG and was never documented.
*** POTENTIAL INCOMPATIBILITY ***
2019-06-06: bkotzz
[Java] #1552 Improve performance in Java std::vector constructor wrapper that takes
a native Java array as input.

View file

@ -199,45 +199,6 @@ namespace Swig {
}
};
/* unknown exception handler */
class UnknownExceptionHandler {
#ifdef SWIG_DIRECTOR_UEH
static void handler() {
try {
throw;
} catch (DirectorException& e) {
std::cerr << "SWIG Director exception caught:" << std::endl
<< e.what() << 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 << std::endl
<< "Python interpreter traceback:" << std::endl;
PyErr_Print();
std::cerr << 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;
throw;
}
public:
std::terminate_handler old;
UnknownExceptionHandler(std::terminate_handler nh = handler) {
old = std::set_terminate(nh);
}
~UnknownExceptionHandler() {
std::set_terminate(old);
}
#endif
};
/* type mismatch in the return value from a python method call */
class DirectorTypeMismatchException : public DirectorException {
public:

View file

@ -153,43 +153,6 @@ namespace Swig {
}
};
/* unknown exception handler */
class UnknownExceptionHandler {
#ifdef SWIG_DIRECTOR_UEH
static void handler() {
try {
throw;
} catch (DirectorException& e) {
std::cerr << "SWIG Director exception caught:" << std::endl
<< e.what() << 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 << std::endl
<< "Ruby interpreter traceback:" << std::endl;
std::cerr << 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;
throw;
}
public:
std::terminate_handler old;
UnknownExceptionHandler(std::terminate_handler nh = handler) {
old = std::set_terminate(nh);
}
~UnknownExceptionHandler() {
std::set_terminate(old);
}
#endif
};
/* Type mismatch in the return value from a Ruby method call */
class DirectorTypeMismatchException : public DirectorException {
public: