Skip to content

Commit

Permalink
Exception: Add CADKernelError exception for specialized OCC exception…
Browse files Browse the repository at this point in the history
… propagation to App::DocumentObject
  • Loading branch information
abdullahtahiriyo authored and wwmayer committed May 3, 2017
1 parent 378a1e4 commit c974e9d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/Base/Exception.cpp
Expand Up @@ -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)
Expand Down
19 changes: 18 additions & 1 deletion src/Base/Exception.h
Expand Up @@ -55,7 +55,7 @@ class BaseExport Exception : public BaseClass
Exception(const std::string& sMessage);
Exception(void);
Exception(const Exception &inst);

protected:
std::string _sErrMsg;
};
Expand Down Expand Up @@ -488,6 +488,23 @@ class BaseExport UnitsMismatchError : public Exception
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)
{
Expand Down

0 comments on commit c974e9d

Please sign in to comment.