-
Notifications
You must be signed in to change notification settings - Fork 47
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
Provide more specific exceptions if the CacheRegion is already configured #40
Comments
Michael Bayer (zzzeek) wrote: there's a couple of issues raised here so let me know your comments on this:
|
Morgan Fainberg () wrote: As it stands, the code is workable, and it isn't a bear to deal with. However, a specific dogpile.cache exception would be better to handle than Exception, in the case that some non-configuration exception occurs, that way it would be possible to handle a second configuration attempt gracefully, but not handle all possible exceptions. Right now dogpile.cache simply raises Exception when it has already been configured. In general, raising more specific exceptions makes for handling those types of errors independently of other errors Example (more ideal) code:
It might also be useful to have an @Property .is_configured to reference instead of having to try/except to validate a configuration has been performed. If you don't get to it first, I'll see if I can propose a changeset to cover this type of change. |
Michael Bayer (zzzeek) wrote: is_configured is great and feel free to implement AlreadyConfigured but I'd make it a subclass of DogpileException or something like that....can you locate other places we're raising Exception and fix those too ? |
Morgan Fainberg () wrote: I will definitely do the exception work as well. Once I have a few spare cycles to work on this I'll get you a pull request with the proposed changes. |
Changes by Michael Bayer (zzzeek):
|
Migrated issue, originally created by Anonymous
Ideally, CacheRegion should raise a dogpile.cache specific exception that can be handled if the region is already configured (and similarly if .backend is attempted to be accessed without the region being configured).
There should also be a method to determine if a Region is already configured (in a friendly manner).
The text was updated successfully, but these errors were encountered: