Exception: Add CADKernelError exception for specialized OCC exception propagation to App::DocumentObject

This commit is contained in:
Abdullah Tahiri
2017-04-27 00:36:02 +02:00
committed by wmayer
parent 378a1e4f58
commit c974e9d752
2 changed files with 35 additions and 1 deletions

View File

@@ -545,6 +545,23 @@ UnitsMismatchError::UnitsMismatchError(const UnitsMismatchError &inst)
{
}
// ---------------------------------------------------------
CADKernelError::CADKernelError(const char * sMessage)
: Exception(sMessage)
{
}
CADKernelError::CADKernelError(const std::string& sMessage)
: Exception(sMessage)
{
}
CADKernelError::CADKernelError(const CADKernelError &inst)
: Exception(inst)
{
}
// ---------------------------------------------------------
#if defined(__GNUC__) && defined (FC_OS_LINUX)

View File

@@ -55,7 +55,7 @@ public: // FIXME: Remove the public keyword
Exception(const std::string& sMessage);
Exception(void);
Exception(const Exception &inst);
protected:
std::string _sErrMsg;
};
@@ -488,6 +488,23 @@ public:
virtual ~UnitsMismatchError() throw() {}
};
/* The CADKernelError can be used to indicate an exception originating in the CAD Kernel
* allowing to propagate the error messages of, for example, OCC Standard_Failure exception to
* the FreeCAD application without making the FreeCAD application depend on OCC.
* @author Abdullah Tahiri
*/
class BaseExport CADKernelError : public Exception
{
public:
/// Construction
CADKernelError(const char * sMessage);
CADKernelError(const std::string& sMessage);
/// Construction
CADKernelError(const CADKernelError &inst);
/// Destruction
virtual ~CADKernelError() throw() {}
};
inline void Exception::setMessage(const char * sMessage)
{