ErrorLogger: Throw InternalError if given severity is not handled

This commit is contained in:
Daniel Marjamäki 2012-08-10 12:43:53 +02:00
parent 355c1322d6
commit ca4ed5e0c3
1 changed files with 8 additions and 8 deletions

View File

@ -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<ErrorLogger::ErrorMessage::FileLocation> &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