Created
February 19, 2012 01:51
-
-
Save jvanasco/1861581 to your computer and use it in GitHub Desktop.
useful python errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Error(Exception): | |
"""Base class for exceptions in this module.""" | |
def __init__(self, value=''): | |
self.value = value | |
def __str__(self): | |
return repr(self.value) | |
class HereIAm(Error): | |
"""Useful for 'breaking' a module when trying to reverse engineer something.""" | |
def __init__(self,value="Rock You Like A Hurricane"): | |
self.value = value | |
class GarfieldMinusGarfield(Error): | |
""" GarfieldMinusGarfield ( ISA Error ) | |
for those surreal moments when something happens that really shouldn't have, but that's okay | |
basically an IntegrityError, but with class | |
""" | |
pass | |
class PollyShouldntBe(Error): | |
""" PollyShouldntBe ( ISA Error ) | |
some things should never exist, like the octo-parrot | |
""" | |
pass | |
class IntegrityError(Error): | |
""" IntegrityError ( ISA Error ) | |
""" | |
pass | |
class ExistingRelation(Error): | |
""" ExistingRelation ( ISA Error ) | |
Raised if we have an existing relation, when we're trying to create a new one | |
""" | |
pass | |
class NoExistingRelation(Error): | |
""" NoExistingRelation ( ISA Error ) | |
Raised if we have an no existing relation, when we're trying to delete one | |
""" | |
pass | |
class EmailSendingError(Error): | |
""" EmailSendingError ( ISA Error ) | |
Oh fuck the fucking email didn't fucking send / pipe into the delivery process. | |
""" | |
pass | |
# | |
# Errors for form submissions | |
# | |
class SubmissionError(Error): | |
""" SubmissionError ( ISA Error ) | |
Generic Form Submission Error | |
""" | |
pass | |
class JsonFormError(Error): | |
""" JsonFormError ( ISA Error ) | |
Raised if wrong/invalid info is submitted to JSON. | |
This is a good way to catch user-displayable errors. | |
""" | |
pass | |
class GetPostFormError(Error): | |
""" GetPostFormError ( ISA Error ) | |
Raised if wrong/invalid info is submitted. | |
This is a good way to catch user-displayable errors. | |
""" | |
pass | |
# | |
# Errors for form submissions | |
# | |
class ConfigurationError(Error): | |
""" ConfigurationError ( ISA Error ) | |
when the configuration was not implemented in a thoughtful, kind, or correct manner | |
""" | |
pass | |
class ScheduledImplementation(Error): | |
""" ScheduledImplementation ( ISA Error ) | |
for we plan on doing this, we just haven't implemented it yet | |
it's very useful for stubbing out API methods | |
""" | |
pass | |
class Deprecated(Error): | |
""" Deprecated ( ISA Error ) | |
We killed this. | |
""" | |
pass | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment