-
Notifications
You must be signed in to change notification settings - Fork 51
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
#28 Use better Exception classes #29
Conversation
Thanks Ewen, but I wanted something different. In those cases, creating a specific exception, like Django does, |
You mean like a custom Exception class? It would just be a subclass of Exception.
Any specific additional requirements? |
Yep, just like that. Don't need Probably a file |
5f79bac
to
fc5dd05
Compare
Thanks, please check if updated PR is OK. |
Thank you very much @ewenchou \o/, do you mind rebasing your branch so that only your changes get merged? |
Add tl;dr section on installation docs
@ewenchou you did a merge, should be a rebase. This way, your PR is changing more things then it should. To fix this, probably |
I thought I did... my steps were:
Is that correct? Maybe I should just do a new fork and put in my changes only 🤷♂️ |
I compared the files from You can manually check the diffs. I think it is safe to merge right now. Please confirm, thanks. |
The changes seems to be ok, what I'm concern is about the commits history. I would prefer to have a consistent tree. I'm sorry for all the trouble @ewenchou and thanks for your patience. |
No problem. I'll re-clone and submit new PR. |
|
||
|
||
class ImproperlyConfigured(Exception): | ||
"""Bottery is somehow improperly configured""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest creating a base exception class and make every bottery exception subclass that. For example, BotteryException.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicoddemus why is that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh missed the previous discussions.
Having a base exception is usually beneficial to clients, because they can just catch BotteryException
if they want to catch any error from the bottery
framework.
class BotteryException(Exception):
"""Base class Bottery exceptions"""
class ImproperlyConfigured(BotteryException):
"""Bottery is somehow improperly configured"""
And so on. This way you initially don't even need to actually specify a ton of exception subclasses, you can just raise BotteryException
; if in the future you realize it is common for users to try to catch a specific error, you can create a subclass and existing clients will continue to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make total sense, thanks @nicoddemus, I'm going to open an issue for that.
For issue #28
Note: Some of the files and
Exception
usage you put in the issue aren't there anymore.