| 39 | PyObject* logexception_error; |
| 40 | |
| 41 | void convertJSBSimToPyExc() |
| 42 | { |
| 43 | try { |
| 44 | if (!PyErr_Occurred()) |
| 45 | throw; |
| 46 | } |
| 47 | catch (const JSBSim::TrimFailureException& e) { |
| 48 | PyErr_SetString(trimfailure_error, e.what()); |
| 49 | } |
| 50 | catch (const GeographicLib::GeographicErr& e) { |
| 51 | PyErr_SetString(geographic_error, e.what()); |
| 52 | } |
| 53 | catch (const JSBSim::LogException& e) { |
| 54 | PyErr_SetString(logexception_error, e.what()); |
| 55 | } |
| 56 | catch (const JSBSim::BaseException& e) { |
| 57 | PyErr_SetString(base_error, e.what()); |
| 58 | } |
| 59 | catch (const JSBSim::FloatingPointException& e) { |
| 60 | PyErr_SetString(e.getPyExc(), e.what()); |
| 61 | } |
| 62 | catch (const std::string &msg) { |
| 63 | PyErr_SetString(PyExc_RuntimeError, msg.c_str()); |
| 64 | } |
| 65 | catch (const char* msg) { |
| 66 | PyErr_SetString(PyExc_RuntimeError, msg); |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | #endif // EXCEPTIONMANAGEMENT_H |