From 83bee99cde8e92d6ef60b2d14edf811cfb0b74ad Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Fri, 16 Nov 2018 07:18:03 +0100 Subject: [PATCH] New Base::Exception type RestoreError --- src/Base/Exception.cpp | 24 ++++++++++++++++++++++++ src/Base/Exception.h | 21 +++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/src/Base/Exception.cpp b/src/Base/Exception.cpp index 1abab22190..cef0c930eb 100644 --- a/src/Base/Exception.cpp +++ b/src/Base/Exception.cpp @@ -827,6 +827,30 @@ CADKernelError::CADKernelError(const CADKernelError &inst) } +// --------------------------------------------------------- +// --------------------------------------------------------- + +RestoreError::RestoreError() + : Exception() +{ +} + +RestoreError::RestoreError(const char * sMessage) + : Exception(sMessage) +{ +} + +RestoreError::RestoreError(const std::string& sMessage) + : Exception(sMessage) +{ +} + +RestoreError::RestoreError(const RestoreError &inst) + : Exception(inst) +{ +} + + // --------------------------------------------------------- #if defined(__GNUC__) && defined (FC_OS_LINUX) diff --git a/src/Base/Exception.h b/src/Base/Exception.h index b2dfdcac26..31abaebf9f 100644 --- a/src/Base/Exception.h +++ b/src/Base/Exception.h @@ -618,6 +618,27 @@ public: virtual ~CADKernelError() throw() {} }; +/* The RestoreError can be used to try to do a best recovery effort when an error during restoring + * occurs. The best recovery effort may be to ignore the element altogether or to insert a placeholder + * depending on where the actual element being restored is used. + * + * For example, if it is part of an array (e.g. PropertyList) and the order in the array is relevant, it + * is better to have a placeholder than to fail to restore the whole array. + */ +class BaseExport RestoreError : public Exception +{ +public: + /// Construction + RestoreError(); + RestoreError(const char * sMessage); + RestoreError(const std::string& sMessage); + /// Construction + RestoreError(const RestoreError &inst); + /// Destruction + virtual ~RestoreError() throw() {} +}; + + inline void Exception::setMessage(const char * sMessage) {