ErrorLogger: Throw InternalError if given severity is not handled
This commit is contained in:
parent
355c1322d6
commit
ca4ed5e0c3
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue