From e5ddb146b646fce35a6a426f435c0a4147fadc40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klemens=20B=C3=B6swirth?= Date: Fri, 28 Jan 2022 14:28:43 +0100 Subject: [PATCH] remove ELEKTRA_ERROR_*_NAME and ELEKTRA_WARNING_*_NAME closes #4230 --- doc/news/_preparation_next_release.md | 2 + src/include/kdberrors.h | 3 - src/libs/elektra/errors.c | 175 ++++++------------ src/libs/elektra/symbols.map | 21 --- .../tools/include/errors/baseNotification.hpp | 11 +- .../tools/include/errors/errorFactory.hpp | 8 +- src/libs/tools/include/errors/errorTypes.hpp | 12 +- .../tools/include/errors/warningFactory.hpp | 8 +- .../tools/include/errors/warningTypes.hpp | 9 - .../tools/src/errors/baseNotification.cpp | 19 +- src/libs/tools/src/errors/errorFactory.cpp | 101 ++++------ src/libs/tools/src/errors/errorTypes.cpp | 40 ---- src/libs/tools/src/errors/warningFactory.cpp | 66 +++---- src/libs/tools/src/errors/warningTypes.cpp | 36 ---- src/libs/tools/tests/testtool_error.cpp | 142 +++++++------- 15 files changed, 217 insertions(+), 436 deletions(-) diff --git a/doc/news/_preparation_next_release.md b/doc/news/_preparation_next_release.md index e810f015f98..37b6375d33e 100644 --- a/doc/news/_preparation_next_release.md +++ b/doc/news/_preparation_next_release.md @@ -111,6 +111,8 @@ The text below summarizes updates to the [C (and C++)-based libraries](https://w - Fix check for valid namespace in keyname creation _(@JakobWonisch)_ - Fix `keyCopyMeta` not deleting non existant keys in destination (see #3981) _(@JakobWonisch)_ +- The `ELEKTRA_ERROR_*_NAME` and `ELEKTRA_WARNING_*_NAME` constants have been removed from the public API. Use `ELEKTRA_ERROR_*` and `ELEKTRA_WARNING_*` instead. _(Klemens Böswirth @kodebach)_ + ### <> - <> diff --git a/src/include/kdberrors.h b/src/include/kdberrors.h index 386629848f1..3311f70b87b 100644 --- a/src/include/kdberrors.h +++ b/src/include/kdberrors.h @@ -268,10 +268,7 @@ using KeySet = ckdb::KeySet; #define DECLARE_ERROR_CODE(cname) \ extern const char * ELEKTRA_ERROR_##cname; \ - extern const char * ELEKTRA_ERROR_##cname##_NAME; \ - \ extern const char * ELEKTRA_WARNING_##cname; \ - extern const char * ELEKTRA_WARNING_##cname##_NAME; \ \ void elektraSetError##cname (Key * key, const char * file, const char * line, const char * module, const char * reason, ...); \ void elektraAddWarning##cname (Key * key, const char * file, const char * line, const char * module, const char * reason, ...); diff --git a/src/libs/elektra/errors.c b/src/libs/elektra/errors.c index abb5a4bce35..973648fffe4 100644 --- a/src/libs/elektra/errors.c +++ b/src/libs/elektra/errors.c @@ -116,15 +116,13 @@ static void setError (Key * key, const char * code, const char * name, const cha #define DEFINE_ERROR_AND_WARNING(cname) \ const char * ELEKTRA_ERROR_##cname = ELEKTRA_ERROR_CODE_##cname; \ - const char * ELEKTRA_ERROR_##cname##_NAME = ELEKTRA_ERROR_CODE_##cname##_NAME; \ const char * ELEKTRA_WARNING_##cname = ELEKTRA_ERROR_CODE_##cname; \ - const char * ELEKTRA_WARNING_##cname##_NAME = ELEKTRA_ERROR_CODE_##cname##_NAME; \ \ void elektraSetError##cname (Key * key, const char * file, const char * line, const char * module, const char * reason, ...) \ { \ va_list va; \ va_start (va, reason); \ - setError (key, ELEKTRA_ERROR_##cname, ELEKTRA_ERROR_##cname##_NAME, file, line, module, reason, va); \ + setError (key, ELEKTRA_ERROR_CODE_##cname, ELEKTRA_ERROR_CODE_##cname##_NAME, file, line, module, reason, va); \ va_end (va); \ } \ \ @@ -132,7 +130,7 @@ static void setError (Key * key, const char * code, const char * name, const cha { \ va_list va; \ va_start (va, reason); \ - addWarning (key, ELEKTRA_WARNING_##cname, ELEKTRA_WARNING_##cname##_NAME, file, line, module, reason, va); \ + addWarning (key, ELEKTRA_ERROR_CODE_##cname, ELEKTRA_ERROR_CODE_##cname##_NAME, file, line, module, reason, va); \ va_end (va); \ } @@ -146,136 +144,85 @@ DEFINE_ERROR_AND_WARNING (CONFLICTING_STATE) DEFINE_ERROR_AND_WARNING (VALIDATION_SYNTACTIC) DEFINE_ERROR_AND_WARNING (VALIDATION_SEMANTIC) +#define ERROR_SPEC_KEYS(cname) \ + keyNew ("system:/elektra/modules/error/specification", KEY_VALUE, "the specification of all error codes", KEY_END), \ + keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_##cname, KEY_END), \ + keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_##cname "/description", KEY_VALUE, \ + ELEKTRA_ERROR_CODE_##cname##_NAME, KEY_END) + KeySet * elektraErrorSpecification (void) { return ksNew (30, - keyNew ("system:/elektra/modules/error/specification", KEY_VALUE, "the specification of all error codes", KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_RESOURCE, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_RESOURCE "/description", KEY_VALUE, - ELEKTRA_ERROR_CODE_RESOURCE_NAME, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_OUT_OF_MEMORY, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_OUT_OF_MEMORY "/description", KEY_VALUE, - ELEKTRA_ERROR_CODE_OUT_OF_MEMORY_NAME, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_INSTALLATION, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_INSTALLATION "/description", KEY_VALUE, - ELEKTRA_ERROR_CODE_INSTALLATION_NAME, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_INTERNAL, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_INTERNAL "/description", KEY_VALUE, - ELEKTRA_ERROR_CODE_INTERNAL_NAME, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_INTERFACE, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_INTERFACE "/description", KEY_VALUE, - ELEKTRA_ERROR_CODE_INTERFACE_NAME, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_PLUGIN_MISBEHAVIOR, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_PLUGIN_MISBEHAVIOR "/description", - KEY_VALUE, ELEKTRA_ERROR_CODE_PLUGIN_MISBEHAVIOR_NAME, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_CONFLICTING_STATE, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_CONFLICTING_STATE "/description", KEY_VALUE, - ELEKTRA_ERROR_CODE_CONFLICTING_STATE_NAME, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_VALIDATION_SYNTACTIC, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_VALIDATION_SYNTACTIC "/description", - KEY_VALUE, ELEKTRA_ERROR_CODE_VALIDATION_SYNTACTIC_NAME, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_VALIDATION_SEMANTIC, KEY_END), - keyNew ("system:/elektra/modules/error/specification/" ELEKTRA_ERROR_CODE_VALIDATION_SEMANTIC "/description", - KEY_VALUE, ELEKTRA_ERROR_CODE_VALIDATION_SEMANTIC_NAME, KEY_END), + // clang-format off + ERROR_SPEC_KEYS (RESOURCE), + ERROR_SPEC_KEYS (OUT_OF_MEMORY), + ERROR_SPEC_KEYS (INSTALLATION), + ERROR_SPEC_KEYS (INTERNAL), + ERROR_SPEC_KEYS (INTERFACE), + ERROR_SPEC_KEYS (PLUGIN_MISBEHAVIOR), + ERROR_SPEC_KEYS (CONFLICTING_STATE), + ERROR_SPEC_KEYS (VALIDATION_SYNTACTIC), + ERROR_SPEC_KEYS (VALIDATION_SEMANTIC), + // clang-format on KS_END); } +#define MAYBE_TRIGGER_WARNING(cname, code, pk, msg) \ + do \ + { \ + if (strcmp (code, ELEKTRA_ERROR_CODE_##cname) == 0) \ + { \ + ELEKTRA_ADD_##cname##_WARNING (pk, msg); \ + return; \ + } \ + } while (0) + void elektraTriggerWarnings (const char * nr, Key * parentKey, const char * message) { - if (strcmp (nr, ELEKTRA_WARNING_RESOURCE) == 0) - { - ELEKTRA_ADD_RESOURCE_WARNING (parentKey, message); - return; - } - if (strcmp (nr, ELEKTRA_WARNING_OUT_OF_MEMORY) == 0) + // OOM error is different, so check that one first + if (strcmp (nr, ELEKTRA_ERROR_CODE_OUT_OF_MEMORY) == 0) { ELEKTRA_ADD_OUT_OF_MEMORY_WARNING (parentKey); return; } - if (strcmp (nr, ELEKTRA_WARNING_INSTALLATION) == 0) - { - ELEKTRA_ADD_INSTALLATION_WARNING (parentKey, message); - return; - } - if (strcmp (nr, ELEKTRA_WARNING_INTERNAL) == 0) - { - ELEKTRA_ADD_INTERNAL_WARNING (parentKey, message); - return; - } - if (strcmp (nr, ELEKTRA_WARNING_INTERFACE) == 0) - { - ELEKTRA_ADD_INTERFACE_WARNING (parentKey, message); - return; - } - if (strcmp (nr, ELEKTRA_WARNING_PLUGIN_MISBEHAVIOR) == 0) - { - ELEKTRA_ADD_PLUGIN_MISBEHAVIOR_WARNING (parentKey, message); - return; - } - if (strcmp (nr, ELEKTRA_WARNING_CONFLICTING_STATE) == 0) - { - ELEKTRA_ADD_CONFLICTING_STATE_WARNING (parentKey, message); - return; - } - if (strcmp (nr, ELEKTRA_WARNING_VALIDATION_SYNTACTIC) == 0) - { - ELEKTRA_ADD_VALIDATION_SYNTACTIC_WARNING (parentKey, message); - return; - } - if (strcmp (nr, ELEKTRA_WARNING_VALIDATION_SEMANTIC) == 0) - { - ELEKTRA_ADD_VALIDATION_SEMANTIC_WARNING (parentKey, message); - return; - } + + MAYBE_TRIGGER_WARNING (RESOURCE, nr, parentKey, message); + MAYBE_TRIGGER_WARNING (INSTALLATION, nr, parentKey, message); + MAYBE_TRIGGER_WARNING (INTERNAL, nr, parentKey, message); + MAYBE_TRIGGER_WARNING (INTERFACE, nr, parentKey, message); + MAYBE_TRIGGER_WARNING (PLUGIN_MISBEHAVIOR, nr, parentKey, message); + MAYBE_TRIGGER_WARNING (CONFLICTING_STATE, nr, parentKey, message); + MAYBE_TRIGGER_WARNING (VALIDATION_SYNTACTIC, nr, parentKey, message); + MAYBE_TRIGGER_WARNING (VALIDATION_SEMANTIC, nr, parentKey, message); ELEKTRA_ADD_INTERNAL_WARNINGF (parentKey, "Unkown warning code %s", nr); } +#define MAYBE_TRIGGER_ERROR(cname, code, pk, msg) \ + do \ + { \ + if (strcmp (code, ELEKTRA_ERROR_CODE_##cname) == 0) \ + { \ + ELEKTRA_SET_##cname##_ERROR (pk, msg); \ + return; \ + } \ + } while (0) + void elektraTriggerError (const char * nr, Key * parentKey, const char * message) { - if (strcmp (nr, ELEKTRA_ERROR_RESOURCE) == 0) - { - ELEKTRA_SET_RESOURCE_ERROR (parentKey, message); - return; - } - if (strcmp (nr, ELEKTRA_ERROR_OUT_OF_MEMORY) == 0) + // OOM error is different, so check that one first + if (strcmp (nr, ELEKTRA_ERROR_CODE_OUT_OF_MEMORY) == 0) { ELEKTRA_SET_OUT_OF_MEMORY_ERROR (parentKey); return; } - if (strcmp (nr, ELEKTRA_ERROR_INSTALLATION) == 0) - { - ELEKTRA_SET_INSTALLATION_ERROR (parentKey, message); - return; - } - if (strcmp (nr, ELEKTRA_ERROR_INTERNAL) == 0) - { - ELEKTRA_SET_INTERNAL_ERROR (parentKey, message); - return; - } - if (strcmp (nr, ELEKTRA_ERROR_INTERFACE) == 0) - { - ELEKTRA_SET_INTERFACE_ERROR (parentKey, message); - return; - } - if (strcmp (nr, ELEKTRA_ERROR_PLUGIN_MISBEHAVIOR) == 0) - { - ELEKTRA_SET_PLUGIN_MISBEHAVIOR_ERROR (parentKey, message); - return; - } - if (strcmp (nr, ELEKTRA_ERROR_CONFLICTING_STATE) == 0) - { - ELEKTRA_SET_CONFLICTING_STATE_ERROR (parentKey, message); - return; - } - if (strcmp (nr, ELEKTRA_ERROR_VALIDATION_SYNTACTIC) == 0) - { - ELEKTRA_SET_VALIDATION_SYNTACTIC_ERROR (parentKey, message); - return; - } - if (strcmp (nr, ELEKTRA_ERROR_VALIDATION_SEMANTIC) == 0) - { - ELEKTRA_SET_VALIDATION_SEMANTIC_ERROR (parentKey, message); - return; - } + + MAYBE_TRIGGER_ERROR (RESOURCE, nr, parentKey, message); + MAYBE_TRIGGER_ERROR (INSTALLATION, nr, parentKey, message); + MAYBE_TRIGGER_ERROR (INTERNAL, nr, parentKey, message); + MAYBE_TRIGGER_ERROR (INTERFACE, nr, parentKey, message); + MAYBE_TRIGGER_ERROR (PLUGIN_MISBEHAVIOR, nr, parentKey, message); + MAYBE_TRIGGER_ERROR (CONFLICTING_STATE, nr, parentKey, message); + MAYBE_TRIGGER_ERROR (VALIDATION_SYNTACTIC, nr, parentKey, message); + MAYBE_TRIGGER_ERROR (VALIDATION_SEMANTIC, nr, parentKey, message); ELEKTRA_SET_INTERNAL_ERRORF (parentKey, "Unkown error code %s", nr); } diff --git a/src/libs/elektra/symbols.map b/src/libs/elektra/symbols.map index 53c0705667c..aa992f37570 100644 --- a/src/libs/elektra/symbols.map +++ b/src/libs/elektra/symbols.map @@ -134,27 +134,6 @@ libelektra_1.0 { ELEKTRA_WARNING_VALIDATION_SEMANTIC; ELEKTRA_WARNING_VALIDATION_SYNTACTIC; - # export also names of errors and warnings - ELEKTRA_ERROR_CONFLICTING_STATE_NAME; - ELEKTRA_ERROR_INSTALLATION_NAME; - ELEKTRA_ERROR_INTERFACE_NAME; - ELEKTRA_ERROR_INTERNAL_NAME; - ELEKTRA_ERROR_OUT_OF_MEMORY_NAME; - ELEKTRA_ERROR_PLUGIN_MISBEHAVIOR_NAME; - ELEKTRA_ERROR_RESOURCE_NAME; - ELEKTRA_ERROR_VALIDATION_SEMANTIC_NAME; - ELEKTRA_ERROR_VALIDATION_SYNTACTIC_NAME; - - ELEKTRA_WARNING_CONFLICTING_STATE_NAME; - ELEKTRA_WARNING_INSTALLATION_NAME; - ELEKTRA_WARNING_INTERFACE_NAME; - ELEKTRA_WARNING_INTERNAL_NAME; - ELEKTRA_WARNING_OUT_OF_MEMORY_NAME; - ELEKTRA_WARNING_PLUGIN_MISBEHAVIOR_NAME; - ELEKTRA_WARNING_RESOURCE_NAME; - ELEKTRA_WARNING_VALIDATION_SEMANTIC_NAME; - ELEKTRA_WARNING_VALIDATION_SYNTACTIC_NAME; - # kdb.h elektraGOptsContract; elektraGOptsContractFromStrings; diff --git a/src/libs/tools/include/errors/baseNotification.hpp b/src/libs/tools/include/errors/baseNotification.hpp index 41adc81fe55..054523b6080 100644 --- a/src/libs/tools/include/errors/baseNotification.hpp +++ b/src/libs/tools/include/errors/baseNotification.hpp @@ -21,12 +21,12 @@ class BaseNotification { public: /* constructor */ - BaseNotification (std::string reason, std::string module, std::string file, std::string mountPoint, std::string configFile, - kdb::long_t line); + BaseNotification (std::string description, std::string reason, std::string module, std::string file, std::string mountPoint, + std::string configFile, kdb::long_t line); /* setters */ - void setData (const std::string & reason, const std::string & module, const std::string & file, const std::string & mountPoint, - const std::string & configFile, kdb::long_t line); + void setData (const std::string & description, const std::string & reason, const std::string & module, const std::string & file, + const std::string & mountPoint, const std::string & configFile, kdb::long_t line); /* get references (for setting and getting member values) */ std::string & reason (); @@ -35,6 +35,7 @@ class BaseNotification std::string & mountPoint (); std::string & configFile (); kdb::long_t & line (); + const std::string & description () const; const std::string & reason () const; const std::string & module () const; const std::string & file () const; @@ -44,7 +45,6 @@ class BaseNotification /* fixed values per Class, taken from C-makro definitions in /src/include/kdberrors.h */ virtual std::string code () const = 0; - virtual std::string description () const = 0; /* string representation */ friend std::ostream & operator<< (std::ostream & outputStream, const BaseNotification & eb); @@ -93,6 +93,7 @@ class BaseNotification virtual std::ostream & toString (std::ostream & outputStream) const; private: + std::string m_description; std::string m_reason; std::string m_module; std::string m_file; diff --git a/src/libs/tools/include/errors/errorFactory.hpp b/src/libs/tools/include/errors/errorFactory.hpp index 33f291aeb4c..791659da350 100644 --- a/src/libs/tools/include/errors/errorFactory.hpp +++ b/src/libs/tools/include/errors/errorFactory.hpp @@ -23,8 +23,9 @@ class ErrorFactory /* takes one of the ELEKTRA_ERROR_* constants (e.g. ELEKTRA_ERROR_OUT_OF_MEMORY) * from /src/include/kdberrors.h as a parameter */ - static Error * create (const std::string & type, const std::string & reason, const std::string & module, const std::string & file, - const std::string & mountPoint, const std::string & configFile, kdb::long_t line); + static Error * create (const std::string & type, const std::string & description, const std::string & reason, + const std::string & module, const std::string & file, const std::string & mountPoint, + const std::string & configFile, kdb::long_t line); /** * @brief Create an error from a given key @@ -37,9 +38,6 @@ class ErrorFactory * @return the error with warnings */ static Error * fromKey (kdb::Key key); - - /* checks if a code and description fit together */ - static bool checkErrorCodeDesc (const std::string & code, const std::string & description); }; } // namespace errors diff --git a/src/libs/tools/include/errors/errorTypes.hpp b/src/libs/tools/include/errors/errorTypes.hpp index da3ba859d44..b2775ae9783 100644 --- a/src/libs/tools/include/errors/errorTypes.hpp +++ b/src/libs/tools/include/errors/errorTypes.hpp @@ -17,12 +17,11 @@ namespace errors class PureWarningError : public Error { public: - PureWarningError () : Error{ "No error, only warnings.", "", "", "", "", 0 } + PureWarningError () : Error{ "Warnings", "No error, only warnings.", "", "", "", "", 0 } { } std::string code () const override; - std::string description () const override; private: bool compare (const BaseNotification & other) const final; @@ -35,7 +34,6 @@ class ResourceError : public Error public: using Error::Error; std::string code () const override; - std::string description () const override; private: bool compare (const BaseNotification & other) const final; @@ -46,7 +44,6 @@ class OutOfMemoryError : public Error public: using Error::Error; std::string code () const override; - std::string description () const override; private: bool compare (const BaseNotification & other) const final; @@ -57,7 +54,6 @@ class InstallationError : public Error public: using Error::Error; std::string code () const override; - std::string description () const override; private: bool compare (const BaseNotification & other) const final; @@ -69,7 +65,6 @@ class InternalError : public Error public: using Error::Error; std::string code () const override; - std::string description () const override; private: bool compare (const BaseNotification & other) const final; @@ -80,7 +75,6 @@ class InterfaceError : public Error public: using Error::Error; std::string code () const override; - std::string description () const override; private: bool compare (const BaseNotification & other) const final; @@ -91,7 +85,6 @@ class PluginMisbehaviorError : public Error public: using Error::Error; std::string code () const override; - std::string description () const override; private: bool compare (const BaseNotification & other) const final; @@ -102,7 +95,6 @@ class ConflictingStateError : public Error public: using Error::Error; std::string code () const override; - std::string description () const override; private: bool compare (const BaseNotification & other) const final; @@ -113,7 +105,6 @@ class ValidationSyntacticError : public Error public: using Error::Error; std::string code () const override; - std::string description () const override; private: bool compare (const BaseNotification & other) const final; @@ -124,7 +115,6 @@ class ValidationSemanticError : public Error public: using Error::Error; std::string code () const override; - std::string description () const override; private: bool compare (const BaseNotification & other) const final; diff --git a/src/libs/tools/include/errors/warningFactory.hpp b/src/libs/tools/include/errors/warningFactory.hpp index 306a9d2009f..75121a3b937 100644 --- a/src/libs/tools/include/errors/warningFactory.hpp +++ b/src/libs/tools/include/errors/warningFactory.hpp @@ -23,11 +23,9 @@ class WarningFactory /* takes one of the ELEKTRA_WARNING_* constants (e.g. ELEKTRA_WARNING_OUT_OF_MEMORY) * from /src/include/kdberrors.h as a parameter */ /* You must delete the object that is returned by this function! */ - static Warning * create (const std::string & type, const std::string & reason, const std::string & module, const std::string & file, - const std::string & mountPoint, const std::string & configFile, kdb::long_t line); - - /* checks if a code and description fit together */ - static bool checkWarningCodeDesc (const std::string & code, const std::string & description); + static Warning * create (const std::string & type, const std::string & description, const std::string & reason, + const std::string & module, const std::string & file, const std::string & mountPoint, + const std::string & configFile, kdb::long_t line); }; } // namespace errors diff --git a/src/libs/tools/include/errors/warningTypes.hpp b/src/libs/tools/include/errors/warningTypes.hpp index 30033d0c743..09bff37da47 100644 --- a/src/libs/tools/include/errors/warningTypes.hpp +++ b/src/libs/tools/include/errors/warningTypes.hpp @@ -19,7 +19,6 @@ class ResourceWarning : public Warning using Warning::Warning; std::string code () const override; - std::string description () const override; ResourceWarning * clone () const override; private: @@ -32,7 +31,6 @@ class OutOfMemoryWarning : public Warning using Warning::Warning; std::string code () const override; - std::string description () const override; OutOfMemoryWarning * clone () const override; private: @@ -45,7 +43,6 @@ class InstallationWarning : public Warning using Warning::Warning; std::string code () const override; - std::string description () const override; InstallationWarning * clone () const override; private: @@ -58,7 +55,6 @@ class InternalWarning : public Warning using Warning::Warning; std::string code () const override; - std::string description () const override; InternalWarning * clone () const override; private: @@ -71,7 +67,6 @@ class InterfaceWarning : public Warning using Warning::Warning; std::string code () const override; - std::string description () const override; InterfaceWarning * clone () const override; private: @@ -84,7 +79,6 @@ class PluginMisbehaviorWarning : public Warning using Warning::Warning; std::string code () const override; - std::string description () const override; PluginMisbehaviorWarning * clone () const override; private: @@ -97,7 +91,6 @@ class ConflictingStateWarning : public Warning using Warning::Warning; std::string code () const override; - std::string description () const override; ConflictingStateWarning * clone () const override; private: @@ -110,7 +103,6 @@ class ValidationSyntacticWarning : public Warning using Warning::Warning; std::string code () const override; - std::string description () const override; ValidationSyntacticWarning * clone () const override; private: @@ -123,7 +115,6 @@ class ValidationSemanticWarning : public Warning using Warning::Warning; std::string code () const override; - std::string description () const override; ValidationSemanticWarning * clone () const override; private: diff --git a/src/libs/tools/src/errors/baseNotification.cpp b/src/libs/tools/src/errors/baseNotification.cpp index ff5e656c321..dc05f25f486 100644 --- a/src/libs/tools/src/errors/baseNotification.cpp +++ b/src/libs/tools/src/errors/baseNotification.cpp @@ -11,16 +11,17 @@ namespace tools namespace errors { -BaseNotification::BaseNotification (std::string reason, std::string module, std::string file, std::string mountPoint, - std::string configFile, kdb::long_t line) -: m_reason (std::move (reason)), m_module (std::move (module)), m_file (std::move (file)), m_mountPoint (std::move (mountPoint)), - m_configFile (std::move (configFile)), m_line (line) +BaseNotification::BaseNotification (std::string description, std::string reason, std::string module, std::string file, + std::string mountPoint, std::string configFile, kdb::long_t line) +: m_description (std::move (description)), m_reason (std::move (reason)), m_module (std::move (module)), m_file (std::move (file)), + m_mountPoint (std::move (mountPoint)), m_configFile (std::move (configFile)), m_line (line) { } -void BaseNotification::setData (const std::string & reason, const std::string & module, const std::string & file, - const std::string & mountPoint, const std::string & configFile, kdb::long_t line) +void BaseNotification::setData (const std::string & description, const std::string & reason, const std::string & module, + const std::string & file, const std::string & mountPoint, const std::string & configFile, kdb::long_t line) { + this->m_description = description; this->m_reason = reason; this->m_module = module; this->m_file = file; @@ -33,7 +34,7 @@ void BaseNotification::setData (const std::string & reason, const std::string & std::ostream & BaseNotification::toString (std::ostream & outputStream) const { return outputStream << "Code: " << code () << std::endl - << "Description: " << description () << std::endl + << "Description: " << m_description << std::endl << "Reason: " << m_reason << std::endl << "Module: " << m_module << std::endl << "File: " << m_file << std::endl @@ -92,6 +93,10 @@ kdb::long_t & BaseNotification::line () } /* getters */ +const std::string & BaseNotification::description () const +{ + return m_description; +} const std::string & BaseNotification::reason () const { return m_reason; diff --git a/src/libs/tools/src/errors/errorFactory.cpp b/src/libs/tools/src/errors/errorFactory.cpp index 698b6e04b80..4731091060e 100644 --- a/src/libs/tools/src/errors/errorFactory.cpp +++ b/src/libs/tools/src/errors/errorFactory.cpp @@ -12,27 +12,28 @@ namespace tools namespace errors { -Error * ErrorFactory::create (const std::string & type, const std::string & reason, const std::string & module, const std::string & file, - const std::string & mountPoint, const std::string & configFile, kdb::long_t line) +Error * ErrorFactory::create (const std::string & type, const std::string & description, const std::string & reason, + const std::string & module, const std::string & file, const std::string & mountPoint, + const std::string & configFile, kdb::long_t line) { - if (type == ELEKTRA_ERROR_RESOURCE || type == ELEKTRA_ERROR_RESOURCE_NAME) - return new ResourceError (reason, module, file, mountPoint, configFile, line); - else if (type == ELEKTRA_ERROR_OUT_OF_MEMORY || type == ELEKTRA_ERROR_OUT_OF_MEMORY_NAME) - return new OutOfMemoryError (reason, module, file, mountPoint, configFile, line); - else if (type == ELEKTRA_ERROR_INSTALLATION || type == ELEKTRA_ERROR_INSTALLATION_NAME) - return new InstallationError (reason, module, file, mountPoint, configFile, line); - else if (type == ELEKTRA_ERROR_INTERNAL || type == ELEKTRA_ERROR_INTERNAL_NAME) - return new InternalError (reason, module, file, mountPoint, configFile, line); - else if (type == ELEKTRA_ERROR_INTERFACE || type == ELEKTRA_ERROR_INTERFACE_NAME) - return new InterfaceError (reason, module, file, mountPoint, configFile, line); - else if (type == ELEKTRA_ERROR_PLUGIN_MISBEHAVIOR || type == ELEKTRA_ERROR_PLUGIN_MISBEHAVIOR_NAME) - return new PluginMisbehaviorError (reason, module, file, mountPoint, configFile, line); - else if (type == ELEKTRA_ERROR_CONFLICTING_STATE || type == ELEKTRA_ERROR_CONFLICTING_STATE_NAME) - return new ConflictingStateError (reason, module, file, mountPoint, configFile, line); - else if (type == ELEKTRA_ERROR_VALIDATION_SYNTACTIC || type == ELEKTRA_ERROR_VALIDATION_SYNTACTIC_NAME) - return new ValidationSyntacticError (reason, module, file, mountPoint, configFile, line); - else if (type == ELEKTRA_ERROR_VALIDATION_SEMANTIC || type == ELEKTRA_ERROR_VALIDATION_SEMANTIC_NAME) - return new ValidationSemanticError (reason, module, file, mountPoint, configFile, line); + if (type == ELEKTRA_ERROR_RESOURCE) + return new ResourceError (description, reason, module, file, mountPoint, configFile, line); + else if (type == ELEKTRA_ERROR_OUT_OF_MEMORY) + return new OutOfMemoryError (description, reason, module, file, mountPoint, configFile, line); + else if (type == ELEKTRA_ERROR_INSTALLATION) + return new InstallationError (description, reason, module, file, mountPoint, configFile, line); + else if (type == ELEKTRA_ERROR_INTERNAL) + return new InternalError (description, reason, module, file, mountPoint, configFile, line); + else if (type == ELEKTRA_ERROR_INTERFACE) + return new InterfaceError (description, reason, module, file, mountPoint, configFile, line); + else if (type == ELEKTRA_ERROR_PLUGIN_MISBEHAVIOR) + return new PluginMisbehaviorError (description, reason, module, file, mountPoint, configFile, line); + else if (type == ELEKTRA_ERROR_CONFLICTING_STATE) + return new ConflictingStateError (description, reason, module, file, mountPoint, configFile, line); + else if (type == ELEKTRA_ERROR_VALIDATION_SYNTACTIC) + return new ValidationSyntacticError (description, reason, module, file, mountPoint, configFile, line); + else if (type == ELEKTRA_ERROR_VALIDATION_SEMANTIC) + return new ValidationSemanticError (description, reason, module, file, mountPoint, configFile, line); else return nullptr; } @@ -56,22 +57,14 @@ Error * ErrorFactory::fromKey (kdb::Key key) std::string errCode = key.getMeta ("error/number"); std::string errDesc = key.getMeta ("error/description"); - if (!checkErrorCodeDesc (errCode, errDesc)) - { - /* TODO: throw exception */ - return nullptr; - } - else - { - std::string module = key.getMeta ("error/module"); - std::string file = key.getMeta ("error/file"); - std::string reason = key.getMeta ("error/reason"); - std::string mountPoint = key.getMeta ("error/mountpoint"); - std::string configFile = key.getMeta ("error/configfile"); - kdb::long_t line = key.getMeta ("error/line"); - - err = create (errCode, reason, module, file, mountPoint, configFile, line); - } + std::string module = key.getMeta ("error/module"); + std::string file = key.getMeta ("error/file"); + std::string reason = key.getMeta ("error/reason"); + std::string mountPoint = key.getMeta ("error/mountpoint"); + std::string configFile = key.getMeta ("error/configfile"); + kdb::long_t line = key.getMeta ("error/line"); + + err = create (errCode, errDesc, reason, module, file, mountPoint, configFile, line); } /* process warnings * @@ -93,12 +86,6 @@ Error * ErrorFactory::fromKey (kdb::Key key) std::string warnCode = warningKeys.get (name + "/number"); std::string warnDescription = warningKeys.get (name + "/description"); - if (!WarningFactory::checkWarningCodeDesc (warnCode, warnDescription)) - { - // TODO: throw exception - return nullptr; - } - std::string warnReason = warningKeys.get (name + "/reason"); std::string warnModule = warningKeys.get (name + "/module"); std::string warnFile = warningKeys.get (name + "/file"); @@ -108,8 +95,8 @@ Error * ErrorFactory::fromKey (kdb::Key key) kdb::long_t warnLine = warningKeys.get (name + "/line"); - Warning * w = WarningFactory::create (warnCode, warnReason, warnModule, warnFile, warnMountPoint, - warnConfigFile, warnLine); + Warning * w = WarningFactory::create (warnCode, warnDescription, warnReason, warnModule, warnFile, + warnMountPoint, warnConfigFile, warnLine); err->addWarning (*w); /* Warning gets copied by addWarning(Warning &) */ @@ -121,30 +108,6 @@ Error * ErrorFactory::fromKey (kdb::Key key) return err; } -bool ErrorFactory::checkErrorCodeDesc (const std::string & code, const std::string & description) -{ - if (code == ELEKTRA_ERROR_RESOURCE) - return (description == ELEKTRA_ERROR_RESOURCE_NAME); - else if (code == ELEKTRA_ERROR_OUT_OF_MEMORY) - return (description == ELEKTRA_ERROR_OUT_OF_MEMORY_NAME); - else if (code == ELEKTRA_ERROR_INSTALLATION) - return (description == ELEKTRA_ERROR_INSTALLATION_NAME); - else if (code == ELEKTRA_ERROR_INTERNAL) - return (description == ELEKTRA_ERROR_INTERNAL_NAME); - else if (code == ELEKTRA_ERROR_INTERFACE) - return (description == ELEKTRA_ERROR_INTERFACE_NAME); - else if (code == ELEKTRA_ERROR_PLUGIN_MISBEHAVIOR) - return (description == ELEKTRA_ERROR_PLUGIN_MISBEHAVIOR_NAME); - else if (code == ELEKTRA_ERROR_CONFLICTING_STATE) - return (description == ELEKTRA_ERROR_CONFLICTING_STATE_NAME); - else if (code == ELEKTRA_ERROR_VALIDATION_SYNTACTIC) - return (description == ELEKTRA_ERROR_VALIDATION_SYNTACTIC_NAME); - else if (code == ELEKTRA_ERROR_VALIDATION_SEMANTIC) - return (description == ELEKTRA_ERROR_VALIDATION_SEMANTIC_NAME); - else - return false; -} - } // namespace errors } // namespace tools -} // namespace kdb \ No newline at end of file +} // namespace kdb diff --git a/src/libs/tools/src/errors/errorTypes.cpp b/src/libs/tools/src/errors/errorTypes.cpp index f40d329d637..76e0dfef8ca 100644 --- a/src/libs/tools/src/errors/errorTypes.cpp +++ b/src/libs/tools/src/errors/errorTypes.cpp @@ -13,10 +13,6 @@ std::string PureWarningError::code () const { return ""; } -std::string PureWarningError::description () const -{ - return "Warnings"; -} bool PureWarningError::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -29,10 +25,6 @@ std::string ResourceError::code () const { return ELEKTRA_ERROR_RESOURCE; } -std::string ResourceError::description () const -{ - return ELEKTRA_ERROR_RESOURCE_NAME; -} bool ResourceError::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -46,10 +38,6 @@ std::string OutOfMemoryError::code () const { return ELEKTRA_ERROR_OUT_OF_MEMORY; } -std::string OutOfMemoryError::description () const -{ - return ELEKTRA_ERROR_OUT_OF_MEMORY_NAME; -} bool OutOfMemoryError::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -62,10 +50,6 @@ std::string InstallationError::code () const { return ELEKTRA_ERROR_INSTALLATION; } -std::string InstallationError::description () const -{ - return ELEKTRA_ERROR_INSTALLATION_NAME; -} bool InstallationError::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -78,10 +62,6 @@ std::string InternalError::code () const { return ELEKTRA_ERROR_INTERNAL; } -std::string InternalError::description () const -{ - return ELEKTRA_ERROR_INTERNAL_NAME; -} bool InternalError::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -94,10 +74,6 @@ std::string InterfaceError::code () const { return ELEKTRA_ERROR_INTERFACE; } -std::string InterfaceError::description () const -{ - return ELEKTRA_ERROR_INTERFACE_NAME; -} bool InterfaceError::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -110,10 +86,6 @@ std::string PluginMisbehaviorError::code () const { return ELEKTRA_ERROR_PLUGIN_MISBEHAVIOR; } -std::string PluginMisbehaviorError::description () const -{ - return ELEKTRA_ERROR_PLUGIN_MISBEHAVIOR_NAME; -} bool PluginMisbehaviorError::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -126,10 +98,6 @@ std::string ConflictingStateError::code () const { return ELEKTRA_ERROR_CONFLICTING_STATE; } -std::string ConflictingStateError::description () const -{ - return ELEKTRA_ERROR_CONFLICTING_STATE_NAME; -} bool ConflictingStateError::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -142,10 +110,6 @@ std::string ValidationSyntacticError::code () const { return ELEKTRA_ERROR_VALIDATION_SYNTACTIC; } -std::string ValidationSyntacticError::description () const -{ - return ELEKTRA_ERROR_VALIDATION_SYNTACTIC_NAME; -} bool ValidationSyntacticError::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -158,10 +122,6 @@ std::string ValidationSemanticError::code () const { return ELEKTRA_ERROR_VALIDATION_SEMANTIC; } -std::string ValidationSemanticError::description () const -{ - return ELEKTRA_ERROR_VALIDATION_SEMANTIC_NAME; -} bool ValidationSemanticError::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) diff --git a/src/libs/tools/src/errors/warningFactory.cpp b/src/libs/tools/src/errors/warningFactory.cpp index 0f355e77c6f..1ff558a9268 100644 --- a/src/libs/tools/src/errors/warningFactory.cpp +++ b/src/libs/tools/src/errors/warningFactory.cpp @@ -10,56 +10,32 @@ namespace tools namespace errors { -Warning * WarningFactory::create (const std::string & type, const std::string & reason, const std::string & module, - const std::string & file, const std::string & mountPoint, const std::string & configFile, - kdb::long_t line) +Warning * WarningFactory::create (const std::string & type, const std::string & description, const std::string & reason, + const std::string & module, const std::string & file, const std::string & mountPoint, + const std::string & configFile, kdb::long_t line) { - if (type == ELEKTRA_WARNING_RESOURCE || type == ELEKTRA_WARNING_RESOURCE_NAME) - return new ResourceWarning (reason, module, file, mountPoint, configFile, line); - else if (type == ELEKTRA_WARNING_OUT_OF_MEMORY || type == ELEKTRA_WARNING_OUT_OF_MEMORY_NAME) - return new OutOfMemoryWarning (reason, module, file, mountPoint, configFile, line); - else if (type == ELEKTRA_WARNING_INSTALLATION || type == ELEKTRA_WARNING_INSTALLATION_NAME) - return new InstallationWarning (reason, module, file, mountPoint, configFile, line); - else if (type == ELEKTRA_WARNING_INTERNAL || type == ELEKTRA_WARNING_INTERNAL_NAME) - return new InternalWarning (reason, module, file, mountPoint, configFile, line); - else if (type == ELEKTRA_WARNING_INTERFACE || type == ELEKTRA_WARNING_INTERFACE_NAME) - return new InterfaceWarning (reason, module, file, mountPoint, configFile, line); - else if (type == ELEKTRA_WARNING_PLUGIN_MISBEHAVIOR || type == ELEKTRA_WARNING_PLUGIN_MISBEHAVIOR_NAME) - return new PluginMisbehaviorWarning (reason, module, file, mountPoint, configFile, line); - else if (type == ELEKTRA_WARNING_CONFLICTING_STATE || type == ELEKTRA_WARNING_CONFLICTING_STATE_NAME) - return new ConflictingStateWarning (reason, module, file, mountPoint, configFile, line); - else if (type == ELEKTRA_WARNING_VALIDATION_SYNTACTIC || type == ELEKTRA_WARNING_VALIDATION_SYNTACTIC_NAME) - return new ValidationSyntacticWarning (reason, module, file, mountPoint, configFile, line); - else if (type == ELEKTRA_WARNING_VALIDATION_SEMANTIC || type == ELEKTRA_WARNING_VALIDATION_SEMANTIC_NAME) - return new ValidationSemanticWarning (reason, module, file, mountPoint, configFile, line); + if (type == ELEKTRA_WARNING_RESOURCE) + return new ResourceWarning (description, reason, module, file, mountPoint, configFile, line); + else if (type == ELEKTRA_WARNING_OUT_OF_MEMORY) + return new OutOfMemoryWarning (description, reason, module, file, mountPoint, configFile, line); + else if (type == ELEKTRA_WARNING_INSTALLATION) + return new InstallationWarning (description, reason, module, file, mountPoint, configFile, line); + else if (type == ELEKTRA_WARNING_INTERNAL) + return new InternalWarning (description, reason, module, file, mountPoint, configFile, line); + else if (type == ELEKTRA_WARNING_INTERFACE) + return new InterfaceWarning (description, reason, module, file, mountPoint, configFile, line); + else if (type == ELEKTRA_WARNING_PLUGIN_MISBEHAVIOR) + return new PluginMisbehaviorWarning (description, reason, module, file, mountPoint, configFile, line); + else if (type == ELEKTRA_WARNING_CONFLICTING_STATE) + return new ConflictingStateWarning (description, reason, module, file, mountPoint, configFile, line); + else if (type == ELEKTRA_WARNING_VALIDATION_SYNTACTIC) + return new ValidationSyntacticWarning (description, reason, module, file, mountPoint, configFile, line); + else if (type == ELEKTRA_WARNING_VALIDATION_SEMANTIC) + return new ValidationSemanticWarning (description, reason, module, file, mountPoint, configFile, line); else return nullptr; } -bool WarningFactory::checkWarningCodeDesc (const std::string & code, const std::string & description) -{ - if (code == ELEKTRA_WARNING_RESOURCE) - return (description == ELEKTRA_WARNING_RESOURCE_NAME); - else if (code == ELEKTRA_WARNING_OUT_OF_MEMORY) - return (description == ELEKTRA_WARNING_OUT_OF_MEMORY_NAME); - else if (code == ELEKTRA_WARNING_INSTALLATION) - return (description == ELEKTRA_WARNING_INSTALLATION_NAME); - else if (code == ELEKTRA_WARNING_INTERNAL) - return (description == ELEKTRA_WARNING_INTERNAL_NAME); - else if (code == ELEKTRA_WARNING_INTERFACE) - return (description == ELEKTRA_WARNING_INTERFACE_NAME); - else if (code == ELEKTRA_WARNING_PLUGIN_MISBEHAVIOR) - return (description == ELEKTRA_WARNING_PLUGIN_MISBEHAVIOR_NAME); - else if (code == ELEKTRA_WARNING_CONFLICTING_STATE) - return (description == ELEKTRA_WARNING_CONFLICTING_STATE_NAME); - else if (code == ELEKTRA_WARNING_VALIDATION_SYNTACTIC) - return (description == ELEKTRA_WARNING_VALIDATION_SYNTACTIC_NAME); - else if (code == ELEKTRA_WARNING_VALIDATION_SEMANTIC) - return (description == ELEKTRA_WARNING_VALIDATION_SEMANTIC_NAME); - else - return false; -} - } // namespace errors } // namespace tools } // namespace kdb \ No newline at end of file diff --git a/src/libs/tools/src/errors/warningTypes.cpp b/src/libs/tools/src/errors/warningTypes.cpp index ba2943ca007..1d53977ee61 100644 --- a/src/libs/tools/src/errors/warningTypes.cpp +++ b/src/libs/tools/src/errors/warningTypes.cpp @@ -13,10 +13,6 @@ std::string ResourceWarning::code () const { return ELEKTRA_WARNING_RESOURCE; } -std::string ResourceWarning::description () const -{ - return ELEKTRA_WARNING_RESOURCE_NAME; -} bool ResourceWarning::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -33,10 +29,6 @@ std::string OutOfMemoryWarning::code () const { return ELEKTRA_WARNING_OUT_OF_MEMORY; } -std::string OutOfMemoryWarning::description () const -{ - return ELEKTRA_WARNING_OUT_OF_MEMORY_NAME; -} bool OutOfMemoryWarning::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -54,10 +46,6 @@ std::string InstallationWarning::code () const { return ELEKTRA_WARNING_INSTALLATION; } -std::string InstallationWarning::description () const -{ - return ELEKTRA_WARNING_INSTALLATION_NAME; -} bool InstallationWarning::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -75,10 +63,6 @@ std::string InternalWarning::code () const { return ELEKTRA_WARNING_INTERNAL; } -std::string InternalWarning::description () const -{ - return ELEKTRA_WARNING_INTERNAL_NAME; -} bool InternalWarning::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -96,10 +80,6 @@ std::string InterfaceWarning::code () const { return ELEKTRA_WARNING_INTERFACE; } -std::string InterfaceWarning::description () const -{ - return ELEKTRA_WARNING_INTERFACE_NAME; -} bool InterfaceWarning::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -117,10 +97,6 @@ std::string PluginMisbehaviorWarning::code () const { return ELEKTRA_WARNING_PLUGIN_MISBEHAVIOR; } -std::string PluginMisbehaviorWarning::description () const -{ - return ELEKTRA_WARNING_PLUGIN_MISBEHAVIOR_NAME; -} bool PluginMisbehaviorWarning::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -137,10 +113,6 @@ std::string ConflictingStateWarning::code () const { return ELEKTRA_WARNING_CONFLICTING_STATE; } -std::string ConflictingStateWarning::description () const -{ - return ELEKTRA_WARNING_CONFLICTING_STATE_NAME; -} bool ConflictingStateWarning::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -158,10 +130,6 @@ std::string ValidationSyntacticWarning::code () const { return ELEKTRA_WARNING_VALIDATION_SYNTACTIC; } -std::string ValidationSyntacticWarning::description () const -{ - return ELEKTRA_WARNING_VALIDATION_SYNTACTIC_NAME; -} bool ValidationSyntacticWarning::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) @@ -179,10 +147,6 @@ std::string ValidationSemanticWarning::code () const { return ELEKTRA_WARNING_VALIDATION_SEMANTIC; } -std::string ValidationSemanticWarning::description () const -{ - return ELEKTRA_WARNING_VALIDATION_SEMANTIC_NAME; -} bool ValidationSemanticWarning::compare (const BaseNotification & other) const { if (!(dynamic_cast (&other))) diff --git a/src/libs/tools/tests/testtool_error.cpp b/src/libs/tools/tests/testtool_error.cpp index 6745c61fed8..c70cf34d4bf 100644 --- a/src/libs/tools/tests/testtool_error.cpp +++ b/src/libs/tools/tests/testtool_error.cpp @@ -16,10 +16,11 @@ TEST (Error, TestWarnings) { /* Resource warning */ std::cout << std::endl << "TEST WARNINGS:" << std::endl; - kdb::tools::errors::ResourceWarning resourceWarning ("resourceWarningReason", "resourceWarningModule", "resourceWarningFile", - "resourceWarningMountPoint", "resourceWarningConfigFile", 0); + kdb::tools::errors::ResourceWarning resourceWarning ("resourceWarningDescription", "resourceWarningReason", "resourceWarningModule", + "resourceWarningFile", "resourceWarningMountPoint", + "resourceWarningConfigFile", 0); ASSERT_EQ (resourceWarning.code (), ELEKTRA_WARNING_RESOURCE); - ASSERT_EQ (resourceWarning.description (), ELEKTRA_WARNING_RESOURCE_NAME); + ASSERT_EQ (resourceWarning.description (), "resourceWarningDescription"); ASSERT_EQ (resourceWarning.reason (), "resourceWarningReason"); ASSERT_EQ (resourceWarning.module (), "resourceWarningModule"); ASSERT_EQ (resourceWarning.file (), "resourceWarningFile"); @@ -28,11 +29,11 @@ TEST (Error, TestWarnings) ASSERT_EQ (resourceWarning.line (), 0); /* Out of memory warning */ - kdb::tools::errors::OutOfMemoryWarning outOfMemoryWarning ("outOfMemoryWarningReason", "outOfMemoryWarningModule", - "outOfMemoryWarningFile", "outOfMemoryWarningMountPoint", - "outOfMemoryWarningConfigFile", 1); + kdb::tools::errors::OutOfMemoryWarning outOfMemoryWarning ("outOfMemoryWarningDescription", "outOfMemoryWarningReason", + "outOfMemoryWarningModule", "outOfMemoryWarningFile", + "outOfMemoryWarningMountPoint", "outOfMemoryWarningConfigFile", 1); ASSERT_EQ (outOfMemoryWarning.code (), ELEKTRA_WARNING_OUT_OF_MEMORY); - ASSERT_EQ (outOfMemoryWarning.description (), ELEKTRA_WARNING_OUT_OF_MEMORY_NAME); + ASSERT_EQ (outOfMemoryWarning.description (), "outOfMemoryWarningDescription"); ASSERT_EQ (outOfMemoryWarning.reason (), "outOfMemoryWarningReason"); ASSERT_EQ (outOfMemoryWarning.module (), "outOfMemoryWarningModule"); ASSERT_EQ (outOfMemoryWarning.file (), "outOfMemoryWarningFile"); @@ -41,11 +42,11 @@ TEST (Error, TestWarnings) ASSERT_EQ (outOfMemoryWarning.line (), 1); /* Installation warning */ - kdb::tools::errors::InstallationWarning installationWarning ("installationWarningReason", "installationWarningModule", - "installationWarningFile", "installationWarningMountPoint", - "installationWarningConfigFile", -1); + kdb::tools::errors::InstallationWarning installationWarning ("installationWarningDescription", "installationWarningReason", + "installationWarningModule", "installationWarningFile", + "installationWarningMountPoint", "installationWarningConfigFile", -1); ASSERT_EQ (installationWarning.code (), ELEKTRA_WARNING_INSTALLATION); - ASSERT_EQ (installationWarning.description (), ELEKTRA_WARNING_INSTALLATION_NAME); + ASSERT_EQ (installationWarning.description (), "installationWarningDescription"); ASSERT_EQ (installationWarning.reason (), "installationWarningReason"); ASSERT_EQ (installationWarning.module (), "installationWarningModule"); ASSERT_EQ (installationWarning.file (), "installationWarningFile"); @@ -54,10 +55,11 @@ TEST (Error, TestWarnings) ASSERT_EQ (installationWarning.line (), -1); /* Internal warning */ - kdb::tools::errors::InternalWarning internalWarning ("internalWarningReason", "internalWarningModule", "internalWarningFile", - "internalWarningMountPoint", "internalWarningConfigFile", 999); + kdb::tools::errors::InternalWarning internalWarning ("internalWarningDescription", "internalWarningReason", "internalWarningModule", + "internalWarningFile", "internalWarningMountPoint", + "internalWarningConfigFile", 999); ASSERT_EQ (internalWarning.code (), ELEKTRA_WARNING_INTERNAL); - ASSERT_EQ (internalWarning.description (), ELEKTRA_WARNING_INTERNAL_NAME); + ASSERT_EQ (internalWarning.description (), "internalWarningDescription"); ASSERT_EQ (internalWarning.reason (), "internalWarningReason"); ASSERT_EQ (internalWarning.module (), "internalWarningModule"); ASSERT_EQ (internalWarning.file (), "internalWarningFile"); @@ -66,10 +68,11 @@ TEST (Error, TestWarnings) ASSERT_EQ (internalWarning.line (), 999); /* Interface warning */ - kdb::tools::errors::InterfaceWarning interfaceWarning ("interfaceWarningReason", "interfaceWarningModule", "interfaceWarningFile", + kdb::tools::errors::InterfaceWarning interfaceWarning ("interfaceWarningDescription", "interfaceWarningReason", + "interfaceWarningModule", "interfaceWarningFile", "interfaceWarningMountPoint", "interfaceWarningConfigFile", 2); ASSERT_EQ (interfaceWarning.code (), ELEKTRA_WARNING_INTERFACE); - ASSERT_EQ (interfaceWarning.description (), ELEKTRA_WARNING_INTERFACE_NAME); + ASSERT_EQ (interfaceWarning.description (), "interfaceWarningDescription"); ASSERT_EQ (interfaceWarning.reason (), "interfaceWarningReason"); ASSERT_EQ (interfaceWarning.module (), "interfaceWarningModule"); ASSERT_EQ (interfaceWarning.file (), "interfaceWarningFile"); @@ -79,10 +82,10 @@ TEST (Error, TestWarnings) /* PluginMisbehavior warning */ kdb::tools::errors::PluginMisbehaviorWarning pluginMisbehaviorWarning ( - "pluginMisbehaviorWarningReason", "pluginMisbehaviorWarningModule", "pluginMisbehaviorWarningFile", - "pluginMisbehaviorWarningMountPoint", "pluginMisbehaviorWarningConfigFile", 3); + "pluginMisbehaviorWarningDescription", "pluginMisbehaviorWarningReason", "pluginMisbehaviorWarningModule", + "pluginMisbehaviorWarningFile", "pluginMisbehaviorWarningMountPoint", "pluginMisbehaviorWarningConfigFile", 3); ASSERT_EQ (pluginMisbehaviorWarning.code (), ELEKTRA_WARNING_PLUGIN_MISBEHAVIOR); - ASSERT_EQ (pluginMisbehaviorWarning.description (), ELEKTRA_WARNING_PLUGIN_MISBEHAVIOR_NAME); + ASSERT_EQ (pluginMisbehaviorWarning.description (), "pluginMisbehaviorWarningDescription"); ASSERT_EQ (pluginMisbehaviorWarning.reason (), "pluginMisbehaviorWarningReason"); ASSERT_EQ (pluginMisbehaviorWarning.module (), "pluginMisbehaviorWarningModule"); ASSERT_EQ (pluginMisbehaviorWarning.file (), "pluginMisbehaviorWarningFile"); @@ -92,10 +95,10 @@ TEST (Error, TestWarnings) /* ConflictingStatie warning */ kdb::tools::errors::ConflictingStateWarning conflictingStateWarning ( - "conflictingStateWarningReason", "conflictingStateWarningModule", "conflictingStateWarningFile", - "conflictingStateWarningMountPoint", "conflictingStateWarningConfigFile", 4); + "conflictingStateWarningDescription", "conflictingStateWarningReason", "conflictingStateWarningModule", + "conflictingStateWarningFile", "conflictingStateWarningMountPoint", "conflictingStateWarningConfigFile", 4); ASSERT_EQ (conflictingStateWarning.code (), ELEKTRA_WARNING_CONFLICTING_STATE); - ASSERT_EQ (conflictingStateWarning.description (), ELEKTRA_WARNING_CONFLICTING_STATE_NAME); + ASSERT_EQ (conflictingStateWarning.description (), "conflictingStateWarningDescription"); ASSERT_EQ (conflictingStateWarning.reason (), "conflictingStateWarningReason"); ASSERT_EQ (conflictingStateWarning.module (), "conflictingStateWarningModule"); ASSERT_EQ (conflictingStateWarning.file (), "conflictingStateWarningFile"); @@ -105,10 +108,10 @@ TEST (Error, TestWarnings) /* ValidationSyntactic warning */ kdb::tools::errors::ValidationSyntacticWarning validationSyntacticWarning ( - "validationSyntacticWarningReason", "validationSyntacticWarningModule", "validationSyntacticWarningFile", - "validationSyntacticMountPoint", "validationSyntacticWarningConfigFile", 5); + "validationSyntacticWarningDescription", "validationSyntacticWarningReason", "validationSyntacticWarningModule", + "validationSyntacticWarningFile", "validationSyntacticMountPoint", "validationSyntacticWarningConfigFile", 5); ASSERT_EQ (validationSyntacticWarning.code (), ELEKTRA_WARNING_VALIDATION_SYNTACTIC); - ASSERT_EQ (validationSyntacticWarning.description (), ELEKTRA_WARNING_VALIDATION_SYNTACTIC_NAME); + ASSERT_EQ (validationSyntacticWarning.description (), "validationSyntacticWarningDescription"); ASSERT_EQ (validationSyntacticWarning.reason (), "validationSyntacticWarningReason"); ASSERT_EQ (validationSyntacticWarning.module (), "validationSyntacticWarningModule"); ASSERT_EQ (validationSyntacticWarning.file (), "validationSyntacticWarningFile"); @@ -118,10 +121,10 @@ TEST (Error, TestWarnings) /* ValidationSemantic warning */ kdb::tools::errors::ValidationSemanticWarning validationSemanticWarning ( - "validationSemanticWarningReason", "validationSemanticWarningModule", "validationSemanticWarningFile", - "validationSemanticWarningMountPoint", "validationSemanticWarningConfigFile", 6); + "validationSemanticWarningDescription", "validationSemanticWarningReason", "validationSemanticWarningModule", + "validationSemanticWarningFile", "validationSemanticWarningMountPoint", "validationSemanticWarningConfigFile", 6); ASSERT_EQ (validationSemanticWarning.code (), ELEKTRA_WARNING_VALIDATION_SEMANTIC); - ASSERT_EQ (validationSemanticWarning.description (), ELEKTRA_WARNING_VALIDATION_SEMANTIC_NAME); + ASSERT_EQ (validationSemanticWarning.description (), "validationSemanticWarningDescription"); ASSERT_EQ (validationSemanticWarning.reason (), "validationSemanticWarningReason"); ASSERT_EQ (validationSemanticWarning.module (), "validationSemanticWarningModule"); ASSERT_EQ (validationSemanticWarning.file (), "validationSemanticWarningFile"); @@ -134,10 +137,10 @@ TEST (Error, TestErrors) { /* Resource error */ std::cout << std::endl << "TEST ERRORS:" << std::endl; - kdb::tools::errors::ResourceError resourceError ("resourceErrorReason", "resourceErrorModule", "resourceErrorFile", - "resourceErrorMountPoint", "resourceErrorConfigFile", 0); + kdb::tools::errors::ResourceError resourceError ("resourceErrorDescription", "resourceErrorReason", "resourceErrorModule", + "resourceErrorFile", "resourceErrorMountPoint", "resourceErrorConfigFile", 0); ASSERT_EQ (resourceError.code (), ELEKTRA_ERROR_RESOURCE); - ASSERT_EQ (resourceError.description (), ELEKTRA_ERROR_RESOURCE_NAME); + ASSERT_EQ (resourceError.description (), "resourceErrorDescription"); ASSERT_EQ (resourceError.reason (), "resourceErrorReason"); ASSERT_EQ (resourceError.module (), "resourceErrorModule"); ASSERT_EQ (resourceError.file (), "resourceErrorFile"); @@ -146,10 +149,11 @@ TEST (Error, TestErrors) ASSERT_EQ (resourceError.line (), 0); /* Out of memory error */ - kdb::tools::errors::OutOfMemoryError outOfMemoryError ("outOfMemoryErrorReason", "outOfMemoryErrorModule", "outOfMemoryErrorFile", + kdb::tools::errors::OutOfMemoryError outOfMemoryError ("outOfMemoryErrorDescription", "outOfMemoryErrorReason", + "outOfMemoryErrorModule", "outOfMemoryErrorFile", "outOfMemoryErrorMountPoint", "outOfMemoryErrorConfigFile", 1); ASSERT_EQ (outOfMemoryError.code (), ELEKTRA_ERROR_OUT_OF_MEMORY); - ASSERT_EQ (outOfMemoryError.description (), ELEKTRA_ERROR_OUT_OF_MEMORY_NAME); + ASSERT_EQ (outOfMemoryError.description (), "outOfMemoryErrorDescription"); ASSERT_EQ (outOfMemoryError.reason (), "outOfMemoryErrorReason"); ASSERT_EQ (outOfMemoryError.module (), "outOfMemoryErrorModule"); ASSERT_EQ (outOfMemoryError.file (), "outOfMemoryErrorFile"); @@ -158,11 +162,11 @@ TEST (Error, TestErrors) ASSERT_EQ (outOfMemoryError.line (), 1); /* Installation error */ - kdb::tools::errors::InstallationError installationError ("installationErrorReason", "installationErrorModule", - "installationErrorFile", "installationErrorMountPoint", - "installationErrorConfigFile", -1); + kdb::tools::errors::InstallationError installationError ("installationErrorDescription", "installationErrorReason", + "installationErrorModule", "installationErrorFile", + "installationErrorMountPoint", "installationErrorConfigFile", -1); ASSERT_EQ (installationError.code (), ELEKTRA_ERROR_INSTALLATION); - ASSERT_EQ (installationError.description (), ELEKTRA_ERROR_INSTALLATION_NAME); + ASSERT_EQ (installationError.description (), "installationErrorDescription"); ASSERT_EQ (installationError.reason (), "installationErrorReason"); ASSERT_EQ (installationError.module (), "installationErrorModule"); ASSERT_EQ (installationError.file (), "installationErrorFile"); @@ -171,11 +175,11 @@ TEST (Error, TestErrors) ASSERT_EQ (installationError.line (), -1); /* Internal error */ - kdb::tools::errors::InternalError internalError ("internalErrorReason", "internalErrorModule", "internalErrorFile", - "internalErrorMountPoint", "internalErrorConfigFile", 999); + kdb::tools::errors::InternalError internalError ("internalErrorDescription", "internalErrorReason", "internalErrorModule", + "internalErrorFile", "internalErrorMountPoint", "internalErrorConfigFile", 999); ASSERT_EQ (internalError.code (), ELEKTRA_ERROR_INTERNAL); - ASSERT_EQ (internalError.description (), ELEKTRA_ERROR_INTERNAL_NAME); + ASSERT_EQ (internalError.description (), "internalErrorDescription"); ASSERT_EQ (internalError.reason (), "internalErrorReason"); ASSERT_EQ (internalError.module (), "internalErrorModule"); ASSERT_EQ (internalError.file (), "internalErrorFile"); @@ -184,10 +188,10 @@ TEST (Error, TestErrors) ASSERT_EQ (internalError.line (), 999); /* Interface error */ - kdb::tools::errors::InterfaceError interfaceError ("interfaceErrorReason", "interfaceErrorModule", "interfaceErrorFile", - "interfaceErrorMountPoint", "interfaceErrorConfigFile", 2); + kdb::tools::errors::InterfaceError interfaceError ("interfaceErrorDescription", "interfaceErrorReason", "interfaceErrorModule", + "interfaceErrorFile", "interfaceErrorMountPoint", "interfaceErrorConfigFile", 2); ASSERT_EQ (interfaceError.code (), ELEKTRA_ERROR_INTERFACE); - ASSERT_EQ (interfaceError.description (), ELEKTRA_ERROR_INTERFACE_NAME); + ASSERT_EQ (interfaceError.description (), "interfaceErrorDescription"); ASSERT_EQ (interfaceError.reason (), "interfaceErrorReason"); ASSERT_EQ (interfaceError.module (), "interfaceErrorModule"); ASSERT_EQ (interfaceError.file (), "interfaceErrorFile"); @@ -196,11 +200,11 @@ TEST (Error, TestErrors) ASSERT_EQ (interfaceError.line (), 2); /* PluginMisbehavior error */ - kdb::tools::errors::PluginMisbehaviorError pluginMisbehaviorError ("pluginMisbehaviorErrorReason", "pluginMisbehaviorErrorModule", - "pluginMisbehaviorErrorFile", "pluginMisbehaviorErrorMountPoint", - "pluginMisbehaviorErrorConfigFile", 3); + kdb::tools::errors::PluginMisbehaviorError pluginMisbehaviorError ( + "pluginMisbehaviorErrorDescription", "pluginMisbehaviorErrorReason", "pluginMisbehaviorErrorModule", + "pluginMisbehaviorErrorFile", "pluginMisbehaviorErrorMountPoint", "pluginMisbehaviorErrorConfigFile", 3); ASSERT_EQ (pluginMisbehaviorError.code (), ELEKTRA_ERROR_PLUGIN_MISBEHAVIOR); - ASSERT_EQ (pluginMisbehaviorError.description (), ELEKTRA_ERROR_PLUGIN_MISBEHAVIOR_NAME); + ASSERT_EQ (pluginMisbehaviorError.description (), "pluginMisbehaviorErrorDescription"); ASSERT_EQ (pluginMisbehaviorError.reason (), "pluginMisbehaviorErrorReason"); ASSERT_EQ (pluginMisbehaviorError.module (), "pluginMisbehaviorErrorModule"); ASSERT_EQ (pluginMisbehaviorError.file (), "pluginMisbehaviorErrorFile"); @@ -209,11 +213,11 @@ TEST (Error, TestErrors) ASSERT_EQ (pluginMisbehaviorError.line (), 3); /* ConflictingStatie error */ - kdb::tools::errors::ConflictingStateError conflictingStateError ("conflictingStateErrorReason", "conflictingStateErrorModule", - "conflictingStateErrorFile", "conflictingStateErrorMountPoint", - "conflictingStateErrorConfigFile", 4); + kdb::tools::errors::ConflictingStateError conflictingStateError ( + "conflictingStateErrorDescription", "conflictingStateErrorReason", "conflictingStateErrorModule", + "conflictingStateErrorFile", "conflictingStateErrorMountPoint", "conflictingStateErrorConfigFile", 4); ASSERT_EQ (conflictingStateError.code (), ELEKTRA_ERROR_CONFLICTING_STATE); - ASSERT_EQ (conflictingStateError.description (), ELEKTRA_ERROR_CONFLICTING_STATE_NAME); + ASSERT_EQ (conflictingStateError.description (), "conflictingStateErrorDescription"); ASSERT_EQ (conflictingStateError.reason (), "conflictingStateErrorReason"); ASSERT_EQ (conflictingStateError.module (), "conflictingStateErrorModule"); ASSERT_EQ (conflictingStateError.file (), "conflictingStateErrorFile"); @@ -223,10 +227,10 @@ TEST (Error, TestErrors) /* ValidationSyntactic error */ kdb::tools::errors::ValidationSyntacticError validationSyntacticError ( - "validationSyntacticErrorReason", "validationSyntacticErrorModule", "validationSyntacticErrorFile", - "validationSyntacticErrorMountPoint", "validationSyntacticErrorConfigFile", 5); + "validationSyntacticErrorDescription", "validationSyntacticErrorReason", "validationSyntacticErrorModule", + "validationSyntacticErrorFile", "validationSyntacticErrorMountPoint", "validationSyntacticErrorConfigFile", 5); ASSERT_EQ (validationSyntacticError.code (), ELEKTRA_ERROR_VALIDATION_SYNTACTIC); - ASSERT_EQ (validationSyntacticError.description (), ELEKTRA_ERROR_VALIDATION_SYNTACTIC_NAME); + ASSERT_EQ (validationSyntacticError.description (), "validationSyntacticErrorDescription"); ASSERT_EQ (validationSyntacticError.reason (), "validationSyntacticErrorReason"); ASSERT_EQ (validationSyntacticError.module (), "validationSyntacticErrorModule"); ASSERT_EQ (validationSyntacticError.file (), "validationSyntacticErrorFile"); @@ -236,10 +240,10 @@ TEST (Error, TestErrors) /* ValidationSemantic error */ kdb::tools::errors::ValidationSemanticError validationSemanticError ( - "validationSemanticErrorReason", "validationSemanticErrorModule", "validationSemanticErrorFile", - "validationSemanticErrorMountPoint", "validationSemanticErrorConfigFile", 6); + "validationSemanticErrorDescription", "validationSemanticErrorReason", "validationSemanticErrorModule", + "validationSemanticErrorFile", "validationSemanticErrorMountPoint", "validationSemanticErrorConfigFile", 6); ASSERT_EQ (validationSemanticError.code (), ELEKTRA_ERROR_VALIDATION_SEMANTIC); - ASSERT_EQ (validationSemanticError.description (), ELEKTRA_ERROR_VALIDATION_SEMANTIC_NAME); + ASSERT_EQ (validationSemanticError.description (), "validationSemanticErrorDescription"); ASSERT_EQ (validationSemanticError.reason (), "validationSemanticErrorReason"); ASSERT_EQ (validationSemanticError.module (), "validationSemanticErrorModule"); ASSERT_EQ (validationSemanticError.file (), "validationSemanticErrorFile"); @@ -251,9 +255,12 @@ TEST (Error, TestErrors) TEST (Error, ErrWarn) { std::cout << std::endl << "TEST ERRORS WITH WARNINGS" << std::endl; - kdb::tools::errors::PluginMisbehaviorError pmE ("pmeReason", "pmeModule", "pmeFile", "pmeMountPoint", "pmeConfigFile", 100); - kdb::tools::errors::ConflictingStateWarning csW ("cswReason", "cswModule", "cswFile", "cswMountPoint", "cswConfigFile", 101); - kdb::tools::errors::InterfaceWarning ifW ("ifwReason", "ifwModule", "ifwFile", "ifwMountPoint", "ifwConfigFile", 102); + kdb::tools::errors::PluginMisbehaviorError pmE ("pmeDescription", "pmeReason", "pmeModule", "pmeFile", "pmeMountPoint", + "pmeConfigFile", 100); + kdb::tools::errors::ConflictingStateWarning csW ("cswDescription", "cswReason", "cswModule", "cswFile", "cswMountPoint", + "cswConfigFile", 101); + kdb::tools::errors::InterfaceWarning ifW ("ifwDescription", "ifwReason", "ifwModule", "ifwFile", "ifwMountPoint", "ifwConfigFile", + 102); pmE.addWarning (csW); pmE.addWarning (ifW); @@ -276,10 +283,12 @@ TEST (Error, Equality) { std::cout << std::endl << "TEST EQUALITY OF WARNINGS AND ERRORS" << std::endl; - kdb::tools::errors::InstallationWarning installationWarning ("Reason", "Module", "File", "MountPoint", "ConfigFile", 42); - kdb::tools::errors::InstallationWarning installationWarning2 ("Reason", "Module", "File", "MountPoint", "ConfigFile", 42); - kdb::tools::errors::InterfaceWarning interfaceWarning ("Reason", "Module", "File", "MountPoint", "ConfigFile", 42); - kdb::tools::errors::InstallationError installationError ("Reason", "Module", "File", "MountPoint", "ConfigFile", 42); + kdb::tools::errors::InstallationWarning installationWarning ("Description", "Reason", "Module", "File", "MountPoint", "ConfigFile", + 42); + kdb::tools::errors::InstallationWarning installationWarning2 ("Description", "Reason", "Module", "File", "MountPoint", "ConfigFile", + 42); + kdb::tools::errors::InterfaceWarning interfaceWarning ("Description", "Reason", "Module", "File", "MountPoint", "ConfigFile", 42); + kdb::tools::errors::InstallationError installationError ("Description", "Reason", "Module", "File", "MountPoint", "ConfigFile", 42); ASSERT_EQ (installationWarning, installationWarning); ASSERT_EQ (installationWarning, installationWarning2); @@ -288,8 +297,9 @@ TEST (Error, Equality) ASSERT_NE (installationWarning, installationError); ASSERT_NE (installationError, installationWarning); - kdb::tools::errors::InstallationError installationError1 ("Reason", "Module", "File", "MountPoint", "ConfigFile", 42); - kdb::tools::errors::ResourceError resourceError ("Reason", "Module", "File", "MountPoint", "ConfigFile", 42); + kdb::tools::errors::InstallationError installationError1 ("Description", "Reason", "Module", "File", "MountPoint", "ConfigFile", + 42); + kdb::tools::errors::ResourceError resourceError ("Description", "Reason", "Module", "File", "MountPoint", "ConfigFile", 42); ASSERT_NE (installationError, resourceError); ASSERT_EQ (installationError, installationError1);