mirror of
https://github.com/hyprwm/hypridle.git
synced 2024-12-22 21:39:48 +01:00
core: throw hyprlang errors
This commit is contained in:
parent
36d7238afd
commit
c8e0016fa5
2 changed files with 25 additions and 13 deletions
|
@ -9,7 +9,8 @@ enum eLogLevel {
|
||||||
LOG,
|
LOG,
|
||||||
WARN,
|
WARN,
|
||||||
ERR,
|
ERR,
|
||||||
CRIT
|
CRIT,
|
||||||
|
NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RASSERT(expr, reason, ...) \
|
#define RASSERT(expr, reason, ...) \
|
||||||
|
@ -36,19 +37,22 @@ namespace Debug {
|
||||||
if (quiet)
|
if (quiet)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::cout << '[';
|
if (level != NONE) {
|
||||||
|
std::cout << '[';
|
||||||
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case TRACE: std::cout << "TRACE"; break;
|
case TRACE: std::cout << "TRACE"; break;
|
||||||
case INFO: std::cout << "INFO"; break;
|
case INFO: std::cout << "INFO"; break;
|
||||||
case LOG: std::cout << "LOG"; break;
|
case LOG: std::cout << "LOG"; break;
|
||||||
case WARN: std::cout << "WARN"; break;
|
case WARN: std::cout << "WARN"; break;
|
||||||
case ERR: std::cout << "ERR"; break;
|
case ERR: std::cout << "ERR"; break;
|
||||||
case CRIT: std::cout << "CRITICAL"; break;
|
case CRIT: std::cout << "CRITICAL"; break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "] ";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "] ";
|
|
||||||
|
|
||||||
std::cout << std::vformat(fmt, std::make_format_args(args...)) << "\n";
|
std::cout << std::vformat(fmt, std::make_format_args(args...)) << "\n";
|
||||||
}
|
}
|
||||||
};
|
};
|
12
src/main.cpp
12
src/main.cpp
|
@ -14,8 +14,16 @@ int main(int argc, char** argv, char** envp) {
|
||||||
Debug::quiet = true;
|
Debug::quiet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pConfigManager = std::make_unique<CConfigManager>();
|
try {
|
||||||
g_pConfigManager->init();
|
g_pConfigManager = std::make_unique<CConfigManager>();
|
||||||
|
g_pConfigManager->init();
|
||||||
|
} catch (const char* err) {
|
||||||
|
Debug::log(CRIT, "ConfigManager threw: {}", err);
|
||||||
|
std::string strerr = err;
|
||||||
|
if (strerr.contains("File does not exist"))
|
||||||
|
Debug::log(NONE, " Make sure you have a config.");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
g_pHypridle = std::make_unique<CHypridle>();
|
g_pHypridle = std::make_unique<CHypridle>();
|
||||||
g_pHypridle->run();
|
g_pHypridle->run();
|
||||||
|
|
Loading…
Reference in a new issue