core: throw hyprlang errors

This commit is contained in:
Vaxry 2024-02-17 22:19:15 +00:00
parent 36d7238afd
commit c8e0016fa5
2 changed files with 25 additions and 13 deletions

View file

@ -9,7 +9,8 @@ enum eLogLevel {
LOG,
WARN,
ERR,
CRIT
CRIT,
NONE
};
#define RASSERT(expr, reason, ...) \
@ -36,6 +37,7 @@ namespace Debug {
if (quiet)
return;
if (level != NONE) {
std::cout << '[';
switch (level) {
@ -45,9 +47,11 @@ namespace Debug {
case WARN: std::cout << "WARN"; break;
case ERR: std::cout << "ERR"; break;
case CRIT: std::cout << "CRITICAL"; break;
default: break;
}
std::cout << "] ";
}
std::cout << std::vformat(fmt, std::make_format_args(args...)) << "\n";
}

View file

@ -14,8 +14,16 @@ int main(int argc, char** argv, char** envp) {
Debug::quiet = true;
}
try {
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->run();