Nasal CppBind: restrict which exceptions are caught
The previous catch policy breaks unit-testing, since CppUnit relies on a special Exception type. This could be made conditional based on testing or not, but trying the simple way initially.
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
#include <simgear/nasal/cppbind/Ghost.hxx>
|
#include <simgear/nasal/cppbind/Ghost.hxx>
|
||||||
#include <simgear/nasal/cppbind/NasalEmesaryInterface.hxx>
|
#include <simgear/nasal/cppbind/NasalEmesaryInterface.hxx>
|
||||||
|
|
||||||
|
#include <simgear/structure/exception.hxx>
|
||||||
#include <simgear/math/SGMath.hxx>
|
#include <simgear/math/SGMath.hxx>
|
||||||
#include <simgear/misc/sg_path.hxx>
|
#include <simgear/misc/sg_path.hxx>
|
||||||
|
|
||||||
@@ -101,13 +102,11 @@ namespace nasal
|
|||||||
{
|
{
|
||||||
return (*func)(nasal::CallContext(c, me, argc, args));
|
return (*func)(nasal::CallContext(c, me, argc, args));
|
||||||
}
|
}
|
||||||
catch(const std::exception& ex)
|
// CppUnit::Exception inherits std::exception, so restrict ourselves to
|
||||||
|
// sg_exception
|
||||||
|
catch (const sg_exception& e)
|
||||||
{
|
{
|
||||||
naRuntimeError(c, "Fatal error in Nasal call: %s", ex.what());
|
naRuntimeError(c, "Fatal error in Nasal call: %s", e.what());
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
naRuntimeError(c, "Unknown exception in Nasal call.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return naNil();
|
return naNil();
|
||||||
|
|||||||
Reference in New Issue
Block a user