slightly better error reporting from app to gui

This commit is contained in:
Stefan Tröger 2013-10-24 17:46:28 +02:00
parent 932c4b5e11
commit dd1044a5e8
6 changed files with 22 additions and 21 deletions

View File

@ -74,26 +74,24 @@ App::DocumentObjectExecReturn* ItemAssembly::execute(void) {
finish(boost::shared_ptr<Solver>());
}
catch(dcm::solving_error& e) {
Base::Console().Error("Solver failed with error %i: %s\n",
*boost::get_error_info<boost::errinfo_errno>(e),
boost::get_error_info<dcm::error_message>(e)->c_str());
catch
(boost::exception& e) {
message.clear();
message << "Solver exception " << *boost::get_error_info<boost::errinfo_errno>(e)
<< "raised: " << boost::get_error_info<dcm::error_message>(e)->c_str() << std::endl;
throw Base::Exception(message.str().c_str());
}
catch(dcm::creation_error& e) {
Base::Console().Error("Creation failed with error %i: %s\n",
*boost::get_error_info<boost::errinfo_errno>(e),
boost::get_error_info<dcm::error_message>(e)->c_str());
catch
(std::exception& e) {
message.clear();
message << "Exception raised in assembly solver: " << e.what() << std::endl;
throw Base::Exception(message.str().c_str());
}
catch(boost::exception& e) {
Base::Console().Error("Solver exception raised: %i: %s\n",
*boost::get_error_info<boost::errinfo_errno>(e),
boost::get_error_info<dcm::error_message>(e)->c_str());
}
catch(std::exception& e) {
Base::Console().Error("Exception raised in assembly solver: %s\n", e.what());
}
catch(...) {
Base::Console().Error("Unknown Exception raised in assembly solver during execution\n");
catch
(...) {
message.clear();
message << "Unknown Exception raised in assembly solver during execution" << std::endl;
throw Base::Exception(message.str().c_str());
};
this->touch();
return App::DocumentObject::StdReturn;

View File

@ -77,6 +77,9 @@ public:
boost::shared_ptr<Solver> m_solver;
Base::Placement m_downstream_placement;
private:
std::stringstream message;
};
} //namespace Assembly

View File

@ -28,6 +28,7 @@
#endif
#include "ViewProvider.h"
#include <ItemAssembly.h>
#include <Gui/Command.h>
//#include <Gui/Document.h>
@ -54,4 +55,3 @@ bool ViewProviderItem::doubleClicked(void)
return true;
}

View File

@ -45,7 +45,6 @@ public:
// returns the root node where the children gets collected(3D)
virtual SoGroup* getChildRoot(void) const {return pcChildren;}
virtual bool doubleClicked(void);
private:
/// group node for all children collected through claimChildren3D(), reused by all Assembly ViewProviders

View File

@ -25,11 +25,13 @@
#ifndef _PreComp_
# include <Inventor/nodes/SoGroup.h>
#include <QMessageBox>
#endif
#include "ViewProviderAssembly.h"
#include <Gui/Command.h>
#include <Gui/Document.h>
#include <Gui/MainWindow.h>
#include <Mod/Assembly/App/ItemAssembly.h>

View File

@ -53,7 +53,6 @@ public:
virtual void setupContextMenu(QMenu* menu, QObject* receiver, const char* member);
virtual bool setEdit(int ModNum);
};