Py: replace BaseExceptionFreeCADError with more suitable exception types
This commit is contained in:
@@ -98,7 +98,7 @@ private:
|
||||
Gui::getMainWindow()->addWindow(view);
|
||||
}
|
||||
else {
|
||||
throw Py::Exception(Base::BaseExceptionFreeCADError, "unknown filetype");
|
||||
throw Py::Exception(PyExc_IOError, "unknown filetype");
|
||||
}
|
||||
|
||||
return Py::None();
|
||||
@@ -125,7 +125,7 @@ private:
|
||||
view->resize( 400, 300 );
|
||||
Gui::getMainWindow()->addWindow(view);
|
||||
} else {
|
||||
throw Py::Exception(Base::BaseExceptionFreeCADError, "unknown filetype");
|
||||
throw Py::Exception(PyExc_IOError, "unknown filetype");
|
||||
}
|
||||
|
||||
return Py::None();
|
||||
@@ -173,10 +173,9 @@ private:
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
if ((*it)->getTypeId().isDerivedFrom(Drawing::FeatureViewPart::getClassTypeId())) {
|
||||
Drawing::FeatureViewPart* view = static_cast<Drawing::FeatureViewPart*>(*it);
|
||||
std::string viewName = view->Label.getValue();
|
||||
App::DocumentObject* link = view->Source.getValue();
|
||||
if (!link) {
|
||||
throw Py::Exception(Base::BaseExceptionFreeCADError, "No object linked");
|
||||
throw Py::ValueError("No object linked");
|
||||
}
|
||||
if (!link->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
throw Py::TypeError("Linked object is not a Part object");
|
||||
|
||||
Reference in New Issue
Block a user