use specialized Python exception classes

This commit is contained in:
wmayer
2017-04-28 19:33:51 +02:00
parent 1673ab801e
commit 18f723cb03
4 changed files with 18 additions and 18 deletions

View File

@@ -350,7 +350,7 @@ static PyObject * importAssembly(PyObject *self, PyObject *args)
aReader.SetNameMode(true);
aReader.SetLayerMode(true);
if (aReader.ReadFile((Standard_CString)(name8bit.c_str())) != IFSelect_RetDone) {
PyErr_SetString(PyExc_Exception, "cannot read STEP file");
PyErr_SetString(PyExc_IOError, "cannot read STEP file");
return 0;
}
@@ -379,7 +379,7 @@ static PyObject * importAssembly(PyObject *self, PyObject *args)
aReader.SetNameMode(true);
aReader.SetLayerMode(true);
if (aReader.ReadFile((Standard_CString)(name8bit.c_str())) != IFSelect_RetDone) {
PyErr_SetString(PyExc_Exception, "cannot read IGES file");
PyErr_SetString(PyExc_IOError, "cannot read IGES file");
return 0;
}
@@ -400,7 +400,7 @@ static PyObject * importAssembly(PyObject *self, PyObject *args)
}
}
else {
PyErr_SetString(PyExc_Exception, "no supported file format");
PyErr_SetString(PyExc_RuntimeError, "no supported file format");
return 0;
}
@@ -411,7 +411,7 @@ static PyObject * importAssembly(PyObject *self, PyObject *args)
}
catch (Standard_Failure) {
Handle(Standard_Failure) e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
PyErr_SetString(PyExc_RuntimeError, e->GetMessageString());
return 0;
}
PY_CATCH