Skip to content

Commit

Permalink
check write_mesh return value
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Dielen committed Jul 9, 2018
1 parent 1101939 commit c500f1e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/InputOutput.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,13 @@ void def_write_mesh(py::module& m) {
if (_color_alpha) options += OM::IO::Options::ColorAlpha;
if (_color_float) options += OM::IO::Options::ColorFloat;

OM::IO::write_mesh(_mesh, _filename, options);
const bool ok = OM::IO::write_mesh(_mesh, _filename, options);

if (!ok) {
const std::string msg = "File could not be written: " + _filename;
PyErr_SetString(PyExc_RuntimeError, msg.c_str());
throw py::error_already_set();
}
},
py::arg("filename"),
py::arg("mesh"),
Expand Down

0 comments on commit c500f1e

Please sign in to comment.