@@ -115,7 +115,8 @@ void PythonInterpreter::runFile(const std::string& filename, const std::vector<s
115115 std::string pycode ((std::istreambuf_iterator<char >(fs)), (std::istreambuf_iterator<char >()));
116116 py::exec (pycode.c_str (), main_namespace);
117117 } catch (const py::error_already_set& e) {
118- throw Pyston::Exception ().log (log4cpp::Priority::ERROR, logger);
118+ PyErr_Print ();
119+ throw Elements::Exception () << " An error occured while running the Python configuration script" ;
119120 } catch (const std::system_error& e) {
120121 throw Elements::Exception () << e.what () << " : " << e.code ().message ();
121122 }
@@ -126,7 +127,8 @@ void PythonInterpreter::setupContext() {
126127 try {
127128 m_measurement_config = py::import (" sourcextractor.config.measurement_config" ).attr (" global_measurement_config" );
128129 } catch (const py::error_already_set& e) {
129- throw Pyston::Exception ().log (log4cpp::Priority::ERROR, logger);
130+ PyErr_Print ();
131+ throw Elements::Exception () << " An error occured while setting up the Python interpreter" ;
130132 }
131133}
132134
@@ -144,7 +146,8 @@ std::map<int, PyMeasurementImage> PythonInterpreter::getMeasurementImages() {
144146 }
145147 return result;
146148 } catch (const py::error_already_set& e) {
147- throw Pyston::Exception ().log (log4cpp::Priority::ERROR, logger);
149+ PyErr_Print ();
150+ throw Elements::Exception () << " An error occurred while retrieving measurement images" ;
148151 }
149152}
150153
@@ -162,7 +165,8 @@ std::map<int, PyAperture> PythonInterpreter::getApertures() {
162165 }
163166 return result;
164167 } catch (const py::error_already_set& e) {
165- throw Pyston::Exception ().log (log4cpp::Priority::ERROR, logger);
168+ PyErr_Print ();
169+ throw Elements::Exception () << " An error occurred while retrieving apertures" ;
166170 }
167171}
168172
@@ -192,7 +196,8 @@ std::vector<std::pair<std::string, std::vector<int>>> PythonInterpreter::getMode
192196 }
193197 return result;
194198 } catch (const py::error_already_set& e) {
195- throw Pyston::Exception ().log (log4cpp::Priority::ERROR, logger);
199+ PyErr_Print ();
200+ throw Elements::Exception () << " An error occurred while retrieving model fitting output columns" ;
196201 }
197202}
198203
@@ -220,7 +225,8 @@ std::map<std::string, std::vector<int>> PythonInterpreter::getApertureOutputColu
220225 }
221226 return result;
222227 } catch (const py::error_already_set& e) {
223- throw Pyston::Exception ().log (log4cpp::Priority::ERROR, logger);
228+ PyErr_Print ();
229+ throw Elements::Exception () << " An error occurred while retrieving aperture output columns" ;
224230 }
225231}
226232
@@ -241,7 +247,8 @@ std::map<int, boost::python::object> PythonInterpreter::getMapFromDict(const cha
241247 }
242248 return result;
243249 } catch (const py::error_already_set& e) {
244- throw Pyston::Exception ().log (log4cpp::Priority::ERROR, logger);
250+ PyErr_Print ();
251+ throw Elements::Exception () << " An error occurred while retrieving map from dict" ;
245252 }
246253}
247254
@@ -302,7 +309,8 @@ std::map<int, std::vector<int>> PythonInterpreter::getFrameModelsMap() {
302309 }
303310 return result;
304311 } catch (const py::error_already_set& e) {
305- throw Pyston::Exception ().log (log4cpp::Priority::ERROR, logger);
312+ PyErr_Print ();
313+ throw Elements::Exception () << " An error occurred while retrieving frame models map" ;
306314 }
307315}
308316
0 commit comments