Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

throwing exceptions inside a library considered harmful #81

Open
mheily opened this issue Jun 11, 2016 · 1 comment
Open

throwing exceptions inside a library considered harmful #81

mheily opened this issue Jun 11, 2016 · 1 comment
Labels

Comments

@mheily
Copy link
Owner

mheily commented Jun 11, 2016

libjob needs to catch exceptions and gracefully error out, because otherwise it will kill the program in unusual ways.

Example:

static std::string get_user_datadir() 
{
    const char *home = getenv("HOME");
    if (!home) {
        throw "Missing HOME directory environment variable";    
    }
@mheily
Copy link
Owner Author

mheily commented Jun 15, 2016

Also, we should stop throwing std::strings, and start throwing custom exceptions that inherit from std::exception. It is very lame to have to catch both std::string AND std::exception everywhere.

@mheily mheily added the bug label Jun 15, 2016
mheily added a commit that referenced this issue Jun 15, 2016
mheily added a commit that referenced this issue Jun 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant