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

Use built-in exceptions #59

Open
miedzinski opened this issue Jan 31, 2016 · 2 comments
Open

Use built-in exceptions #59

miedzinski opened this issue Jan 31, 2016 · 2 comments

Comments

@miedzinski
Copy link

It's only a matter of coding style and isn't that important, but there shouldn't be unnecesary exceptions created. I think OSError is perfectly fine for all exceptions defined.
This change shouldn't break anything, because I doubt anyone is using dotfiles as library.
If you don't think these exceptions should be removed, atleast subclass DotfileException with OSError.

@jbernard
Copy link
Owner

jbernard commented Feb 2, 2016

Thanks for the thoughts. Just curious, is this coding style documented somewhere, or just your preference? You're saying remove the defined exceptions in dotfiles/exceptions.py and just use OSError, what about errno in that case? What I liked about the exceptions is that the code is very readable at the point of raise, I'm not passing in error strings, or formatting anything, just the dotfile name and the exception class does the rest - that seemed elegant to me. Can you post a snippet of what you had in mind? I'd love to remove them entirely as long as I can keep things readable in the main functions.

Cheers

@prologic
Copy link

prologic commented Feb 2, 2016

FWIW I think it's fine to raise custom exceptions like this. It's not always a good idea in the case of librariy code but as this is a tool/application I think it's fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants