procfetch icon indicating copy to clipboard operation
procfetch copied to clipboard

Handle failures and exceptions

Open TanmayPatil105 opened this issue 9 months ago • 0 comments

Currently, the program doesn't handle exceptions and it halts. I'm listing some failures here that I have experienced.

1. Username

string getuser()
{   
    return getenv("USER");
}

See discussion on https://github.com/TanmayPatil105/procfetch/pull/145!

2. Theme

string getTheme()
{   
    auto args = "gsettings get org.gnome.desktop.interface gtk-theme"s;
    auto s = Command::exec(args)->getOutput();
    return s.substr(1, s.find("\'", 1) - 1);
}   

Some machines don't have it installed. For example, Docker containers.

3. Icons

string getIcons()
{
    auto args = "gsettings get org.gnome.desktop.interface icon-theme"s;
    auto s = Command::exec(args)->getOutput();
    return s.substr(1, s.find("\'", 1) - 1);
}

Same as above

TanmayPatil105 avatar May 12 '24 05:05 TanmayPatil105