From ca4ed5e0c3d4b9c92934b0cbc784e4be0646f0d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 10 Aug 2012 12:43:53 +0200 Subject: [PATCH] ErrorLogger: Throw InternalError if given severity is not handled --- lib/errorlogger.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/errorlogger.h b/lib/errorlogger.h index 34ae6f029..f8b36b484 100644 --- a/lib/errorlogger.h +++ b/lib/errorlogger.h @@ -32,6 +32,13 @@ class TokenList; /// @addtogroup Core /// @{ +/** @brief Simple container to be thrown when internal error is detected. */ +struct InternalError { + InternalError(const Token *tok, const std::string &errorMsg); + const Token *token; + std::string errorMessage; +}; + /** @brief enum class for severity. Used when reporting errors. */ class CPPCHECKLIB Severity { public: @@ -109,7 +116,7 @@ public: case debug: return "debug"; }; - return "???"; + throw InternalError(NULL, "Unknown severity"); } static SeverityType fromString(const std::string &severity) { if (severity.empty()) @@ -299,13 +306,6 @@ public: static std::string callStackToString(const std::list &callStack); }; -/** @brief Simple container to be thrown when internal error is detected. */ -struct InternalError { - InternalError(const Token *tok, const std::string &errorMsg); - const Token *token; - std::string errorMessage; -}; - /// @} #endif