hyprpm: add short error code explanations

This commit is contained in:
Vaxry 2024-07-30 11:54:28 +02:00
parent e673220340
commit 743e98f0c0
2 changed files with 15 additions and 1 deletions

View file

@ -529,7 +529,8 @@ bool CPluginManager::updateHeaders(bool force) {
std::cout << "\n"; std::cout << "\n";
} else { } else {
progress.printMessageAbove(std::string{Colors::RED} + "" + Colors::RESET + " failed to install headers with error code " + std::to_string((int)HEADERSVALID)); progress.printMessageAbove(std::string{Colors::RED} + "" + Colors::RESET + " failed to install headers with error code " + std::to_string((int)HEADERSVALID) + " (" +
headerErrorShort(HEADERSVALID) + ")");
progress.m_iSteps = 5; progress.m_iSteps = 5;
progress.m_szCurrentMessage = "Failed"; progress.m_szCurrentMessage = "Failed";
progress.print(); progress.print();
@ -880,6 +881,18 @@ std::string CPluginManager::headerError(const eHeadersErrors err) {
return std::string{Colors::RED} + "" + Colors::RESET + " Unknown header error. Please run hyprpm update to fix those.\n"; return std::string{Colors::RED} + "" + Colors::RESET + " Unknown header error. Please run hyprpm update to fix those.\n";
} }
std::string CPluginManager::headerErrorShort(const eHeadersErrors err) {
switch (err) {
case HEADERS_CORRUPTED: return "Headers corrupted";
case HEADERS_MISMATCHED: return "Headers version mismatched";
case HEADERS_NOT_HYPRLAND: return "Not running on Hyprland";
case HEADERS_MISSING: return "Headers missing";
case HEADERS_DUPLICATED: return "Headers duplicated";
default: break;
}
return "?";
}
bool CPluginManager::hasDeps() { bool CPluginManager::hasDeps() {
std::vector<std::string> deps = {"meson", "cpio", "cmake"}; std::vector<std::string> deps = {"meson", "cpio", "cmake"};
for (auto& d : deps) { for (auto& d : deps) {

View file

@ -66,6 +66,7 @@ class CPluginManager {
private: private:
std::string headerError(const eHeadersErrors err); std::string headerError(const eHeadersErrors err);
std::string headerErrorShort(const eHeadersErrors err);
std::string m_szWorkingPluginDirectory = ""; std::string m_szWorkingPluginDirectory = "";
}; };