Tidy up director_exception testcase

This commit is contained in:
William S Fulton 2017-11-17 20:20:05 +00:00
commit 91080872a8

View file

@ -20,14 +20,10 @@
#ifndef SWIG_DIRECTORS #ifndef SWIG_DIRECTORS
namespace Swig { namespace Swig {
class DirectorException {}; class DirectorException {};
class DirectorMethodException: public Swig::DirectorException {}; class DirectorMethodException: public Swig::DirectorException {};
} }
#ifndef SWIG_fail
#define SWIG_fail
#endif
#endif /* !SWIG_DIRECTORS */ #endif /* !SWIG_DIRECTORS */
%} %}
%include "std_string.i" %include "std_string.i"
@ -41,8 +37,8 @@ class DirectorMethodException: public Swig::DirectorException {};
} }
%exception { %exception {
try { $action } try { $action }
catch (Swig::DirectorException &) { SWIG_fail; } catch (Swig::DirectorException &) { SWIG_fail; }
} }
#endif #endif
@ -56,8 +52,8 @@ class DirectorMethodException: public Swig::DirectorException {};
} }
%exception { %exception {
try { $action } try { $action }
catch (Swig::DirectorException &) { SWIG_fail; } catch (Swig::DirectorException &) { SWIG_fail; }
} }
#endif #endif
@ -75,12 +71,12 @@ class DirectorMethodException: public Swig::DirectorException {};
// Change back to old 2.0 default behavior // Change back to old 2.0 default behavior
%feature("director:except") { %feature("director:except") {
jthrowable $error = jenv->ExceptionOccurred(); jthrowable $error = jenv->ExceptionOccurred();
if ($error) { if ($error) {
// Dont clear exception, still be active when return to java execution // Dont clear exception, still be active when return to java execution
// Essentially ignore exception occurred -- old behavior. // Essentially ignore exception occurred -- old behavior.
return $null; return $null;
} }
} }
#endif #endif