diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2019-06-24 08:37:29 +0100 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2019-06-27 07:40:49 +0100 |
commit | b655d3138b2dff046912041c036b2dd87a195a81 (patch) | |
tree | 81a9bc966503a002b22a11f9485260dc1c43efe4 /Lib | |
parent | 959c2283818e76903901dddfea041d451eade686 (diff) | |
download | swig-b655d3138b2dff046912041c036b2dd87a195a81.tar.gz |
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
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/python/director.swg | 39 | ||||
-rw-r--r-- | Lib/ruby/director.swg | 37 |
2 files changed, 0 insertions, 76 deletions
diff --git a/Lib/python/director.swg b/Lib/python/director.swg index 36df302f1..9694c6233 100644 --- a/Lib/python/director.swg +++ b/Lib/python/director.swg @@ -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: diff --git a/Lib/ruby/director.swg b/Lib/ruby/director.swg index a0569785f..9395b8183 100644 --- a/Lib/ruby/director.swg +++ b/Lib/ruby/director.swg @@ -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: |