From 57698ef73c6eb6fe7744a209bddb04e615c94552 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Mon, 8 May 2017 14:34:23 +0200 Subject: [PATCH] Provide default constructors for all exception types --- src/Base/Exception.cpp | 109 ++++++++++++++++++++++++++++++++++++++++- src/Base/Exception.h | 21 +++++++- 2 files changed, 128 insertions(+), 2 deletions(-) diff --git a/src/Base/Exception.cpp b/src/Base/Exception.cpp index d4c2c65586..32979349d7 100644 --- a/src/Base/Exception.cpp +++ b/src/Base/Exception.cpp @@ -99,6 +99,7 @@ void Exception::ReportException (void) const // --------------------------------------------------------- + AbortException::AbortException(const char * sMessage) : Exception( sMessage ) { @@ -121,6 +122,12 @@ const char* AbortException::what() const throw() // --------------------------------------------------------- + +XMLBaseException::XMLBaseException() +: Exception() +{ +} + XMLBaseException::XMLBaseException(const char * sMessage) : Exception(sMessage) { @@ -138,6 +145,7 @@ XMLBaseException::XMLBaseException(const XMLBaseException &inst) // --------------------------------------------------------- + XMLParseException::XMLParseException(const char * sMessage) : Exception(sMessage) { @@ -165,6 +173,7 @@ const char* XMLParseException::what() const throw() // --------------------------------------------------------- + FileException::FileException(const char * sMessage, const char * sFileName) : Exception( sMessage ),file(sFileName) { @@ -235,6 +244,12 @@ void FileException::ReportException (void) const // --------------------------------------------------------- + +FileSystemError::FileSystemError() +: Exception() +{ +} + FileSystemError::FileSystemError(const char * sMessage) : Exception(sMessage) { @@ -252,6 +267,12 @@ FileSystemError::FileSystemError(const FileSystemError &inst) // --------------------------------------------------------- + +BadFormatError::BadFormatError() +: Exception() +{ +} + BadFormatError::BadFormatError(const char * sMessage) : Exception(sMessage) { @@ -269,6 +290,7 @@ BadFormatError::BadFormatError(const BadFormatError &inst) // --------------------------------------------------------- + MemoryException::MemoryException() { _sErrMsg = "Not enough memory available"; @@ -337,6 +359,11 @@ AbnormalProgramTermination::AbnormalProgramTermination(const AbnormalProgramTerm // --------------------------------------------------------- +UnknownProgramOption::UnknownProgramOption() +: Exception() +{ +} + UnknownProgramOption::UnknownProgramOption(const char * sMessage) : Exception(sMessage) { @@ -354,6 +381,11 @@ UnknownProgramOption::UnknownProgramOption(const UnknownProgramOption &inst) // --------------------------------------------------------- +ProgramInformation::ProgramInformation() +: Exception() +{ +} + ProgramInformation::ProgramInformation(const char * sMessage) : Exception(sMessage) { @@ -371,6 +403,11 @@ ProgramInformation::ProgramInformation(const ProgramInformation &inst) // --------------------------------------------------------- +TypeError::TypeError() +: Exception() +{ +} + TypeError::TypeError(const char * sMessage) : Exception(sMessage) { @@ -388,6 +425,11 @@ TypeError::TypeError(const TypeError &inst) // --------------------------------------------------------- +ValueError::ValueError() +: Exception() +{ +} + ValueError::ValueError(const char * sMessage) : Exception(sMessage) { @@ -405,6 +447,11 @@ ValueError::ValueError(const ValueError &inst) // --------------------------------------------------------- +IndexError::IndexError() +: Exception() +{ +} + IndexError::IndexError(const char * sMessage) : Exception(sMessage) { @@ -422,6 +469,11 @@ IndexError::IndexError(const IndexError &inst) // --------------------------------------------------------- +AttributeError::AttributeError() +: Exception() +{ +} + AttributeError::AttributeError(const char * sMessage) : Exception(sMessage) { @@ -439,6 +491,11 @@ AttributeError::AttributeError(const AttributeError &inst) // --------------------------------------------------------- +RuntimeError::RuntimeError() +: Exception() +{ +} + RuntimeError::RuntimeError(const char * sMessage) : Exception(sMessage) { @@ -456,6 +513,11 @@ RuntimeError::RuntimeError(const RuntimeError &inst) // --------------------------------------------------------- +NotImplementedError::NotImplementedError() +: Exception() +{ +} + NotImplementedError::NotImplementedError(const char * sMessage) : Exception(sMessage) { @@ -473,6 +535,11 @@ NotImplementedError::NotImplementedError(const NotImplementedError &inst) // --------------------------------------------------------- +DivisionByZeroError::DivisionByZeroError() +: Exception() +{ +} + DivisionByZeroError::DivisionByZeroError(const char * sMessage) : Exception(sMessage) { @@ -490,6 +557,11 @@ DivisionByZeroError::DivisionByZeroError(const DivisionByZeroError &inst) // --------------------------------------------------------- +ReferencesError::ReferencesError() +: Exception() +{ +} + ReferencesError::ReferencesError(const char * sMessage) : Exception(sMessage) { @@ -507,6 +579,11 @@ ReferencesError::ReferencesError(const ReferencesError &inst) // --------------------------------------------------------- +ExpressionError::ExpressionError() +: Exception() +{ +} + ExpressionError::ExpressionError(const char * sMessage) : Exception(sMessage) { @@ -524,6 +601,11 @@ ExpressionError::ExpressionError(const ExpressionError &inst) // --------------------------------------------------------- +ParserError::ParserError() +: Exception() +{ +} + ParserError::ParserError(const char * sMessage) : Exception(sMessage) { @@ -541,6 +623,11 @@ ParserError::ParserError(const ParserError &inst) // --------------------------------------------------------- +UnicodeError::UnicodeError() +: Exception() +{ +} + UnicodeError::UnicodeError(const char * sMessage) : Exception(sMessage) { @@ -558,6 +645,11 @@ UnicodeError::UnicodeError(const UnicodeError &inst) // --------------------------------------------------------- +OverflowError::OverflowError() +: Exception() +{ +} + OverflowError::OverflowError(const char * sMessage) : Exception(sMessage) { @@ -575,6 +667,11 @@ OverflowError::OverflowError(const OverflowError &inst) // --------------------------------------------------------- +UnderflowError::UnderflowError() +: Exception() +{ +} + UnderflowError::UnderflowError(const char * sMessage) : Exception(sMessage) { @@ -592,6 +689,11 @@ UnderflowError::UnderflowError(const UnderflowError &inst) // --------------------------------------------------------- +UnitsMismatchError::UnitsMismatchError() +: Exception() +{ +} + UnitsMismatchError::UnitsMismatchError(const char * sMessage) : Exception(sMessage) { @@ -608,7 +710,12 @@ UnitsMismatchError::UnitsMismatchError(const UnitsMismatchError &inst) } // --------------------------------------------------------- - + +CADKernelError::CADKernelError() +: Exception() +{ +} + CADKernelError::CADKernelError(const char * sMessage) : Exception(sMessage) { diff --git a/src/Base/Exception.h b/src/Base/Exception.h index e40c60cdd4..148a0e02f9 100644 --- a/src/Base/Exception.h +++ b/src/Base/Exception.h @@ -61,7 +61,6 @@ namespace Base class BaseExport Exception : public BaseClass { TYPESYSTEM_HEADER(); - public: virtual ~Exception() throw() {} @@ -133,6 +132,7 @@ class BaseExport XMLBaseException : public Exception { public: /// Construction + XMLBaseException(); XMLBaseException(const char * sMessage); XMLBaseException(const std::string& sMessage); /// Construction @@ -202,6 +202,7 @@ class BaseExport FileSystemError : public Exception { public: /// Construction + FileSystemError(); FileSystemError(const char * sMessage); FileSystemError(const std::string& sMessage); /// Construction @@ -218,6 +219,7 @@ class BaseExport BadFormatError : public Exception { public: /// Construction + BadFormatError(); BadFormatError(const char * sMessage); BadFormatError(const std::string& sMessage); /// Construction @@ -292,6 +294,7 @@ class BaseExport UnknownProgramOption : public Exception { public: /// Construction + UnknownProgramOption(); UnknownProgramOption(const char * sMessage); UnknownProgramOption(const std::string& sMessage); /// Construction @@ -308,6 +311,7 @@ class BaseExport ProgramInformation : public Exception { public: /// Construction + ProgramInformation(); ProgramInformation(const char * sMessage); ProgramInformation(const std::string& sMessage); /// Construction @@ -325,6 +329,7 @@ class BaseExport TypeError : public Exception { public: /// Construction + TypeError(); TypeError(const char * sMessage); TypeError(const std::string& sMessage); /// Construction @@ -341,6 +346,7 @@ class BaseExport ValueError : public Exception { public: /// Construction + ValueError(); ValueError(const char * sMessage); ValueError(const std::string& sMessage); /// Construction @@ -357,6 +363,7 @@ class BaseExport IndexError : public Exception { public: /// Construction + IndexError(); IndexError(const char * sMessage); IndexError(const std::string& sMessage); /// Construction @@ -373,6 +380,7 @@ class BaseExport AttributeError : public Exception { public: /// Construction + AttributeError(); AttributeError(const char * sMessage); AttributeError(const std::string& sMessage); /// Construction @@ -389,6 +397,7 @@ class BaseExport RuntimeError : public Exception { public: /// Construction + RuntimeError(); RuntimeError(const char * sMessage); RuntimeError(const std::string& sMessage); /// Construction @@ -405,6 +414,7 @@ class BaseExport NotImplementedError : public Exception { public: /// Construction + NotImplementedError(); NotImplementedError(const char * sMessage); NotImplementedError(const std::string& sMessage); /// Construction @@ -421,6 +431,7 @@ class BaseExport DivisionByZeroError : public Exception { public: /// Construction + DivisionByZeroError(); DivisionByZeroError(const char * sMessage); DivisionByZeroError(const std::string& sMessage); /// Construction @@ -437,6 +448,7 @@ class BaseExport ReferencesError : public Exception { public: /// Construction + ReferencesError(); ReferencesError(const char * sMessage); ReferencesError(const std::string& sMessage); /// Construction @@ -454,6 +466,7 @@ class BaseExport ExpressionError : public Exception { public: /// Construction + ExpressionError(); ExpressionError(const char * sMessage); ExpressionError(const std::string& sMessage); /// Construction @@ -470,6 +483,7 @@ class BaseExport ParserError : public Exception { public: /// Construction + ParserError(); ParserError(const char * sMessage); ParserError(const std::string& sMessage); /// Construction @@ -486,6 +500,7 @@ class BaseExport UnicodeError : public Exception { public: /// Construction + UnicodeError(); UnicodeError(const char * sMessage); UnicodeError(const std::string& sMessage); /// Construction @@ -502,6 +517,7 @@ class BaseExport OverflowError : public Exception { public: /// Construction + OverflowError(); OverflowError(const char * sMessage); OverflowError(const std::string& sMessage); /// Construction @@ -518,6 +534,7 @@ class BaseExport UnderflowError : public Exception { public: /// Construction + UnderflowError(); UnderflowError(const char * sMessage); UnderflowError(const std::string& sMessage); /// Construction @@ -534,6 +551,7 @@ class BaseExport UnitsMismatchError : public Exception { public: /// Construction + UnitsMismatchError(); UnitsMismatchError(const char * sMessage); UnitsMismatchError(const std::string& sMessage); /// Construction @@ -551,6 +569,7 @@ class BaseExport CADKernelError : public Exception { public: /// Construction + CADKernelError(); CADKernelError(const char * sMessage); CADKernelError(const std::string& sMessage); /// Construction