use specialized Python exception classes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user