1
0
mirror of synced 2024-11-14 02:57:41 +01:00

pattern: Cleanup log console a bit

This commit is contained in:
WerWolv 2022-02-11 16:53:01 +01:00
parent b4a3eb240e
commit 57f31123e7
2 changed files with 5 additions and 10 deletions

View File

@ -16,7 +16,8 @@ namespace hex::pl {
class LogConsole {
public:
enum Level {
enum Level
{
Debug,
Info,
Warning,
@ -27,9 +28,7 @@ namespace hex::pl {
void log(Level level, const std::string &message);
[[noreturn]] static void abortEvaluation(const std::string &message);
[[noreturn]] static void abortEvaluation(const std::string &message, const ASTNode *node);
[[noreturn]] static void abortEvaluation(const std::string &message, const ASTNode *node = nullptr);
void clear();

View File

@ -8,15 +8,11 @@ namespace hex::pl {
this->m_consoleLog.emplace_back(level, message);
}
[[noreturn]] void LogConsole::abortEvaluation(const std::string &message) {
throw PatternLanguageError(0, message);
}
[[noreturn]] void LogConsole::abortEvaluation(const std::string &message, const ASTNode *node) {
if (node == nullptr)
abortEvaluation(message);
throw PatternLanguageError(0, "Evaluator: " + message);
else
throw PatternLanguageError(node->getLineNumber(), message);
throw PatternLanguageError(node->getLineNumber(), "Evaluator: " + message);
}
void LogConsole::clear() {