Source code for downtoearth.exceptions

"""Exceptions for downtoearth.

These are helpers provided so that you can raise proper HTTP code errors from your API.

Usage:
    from downtoearth.exceptions import NotFoundException
    raise NotFoundException('your princess is in another castle')
"""
[docs]class BadRequestException(Exception): def __init__(self, msg): prefix = '[Bad Request]' super(BadRequestException, self).__init__(prefix + ' ' + msg)
[docs]class ConflictException(Exception): def __init__(self, msg): prefix = '[Conflict]' super(ConflictException, self).__init__(prefix + ' ' + msg)
[docs]class InternalServerErrorException(Exception): def __init__(self, msg): prefix = '[Internal Server Error]' super(InternalServerErrorException, self).__init__(prefix + ' ' + msg)
[docs]class NotFoundException(Exception): def __init__(self, msg): prefix = '[Not Found]' super(NotFoundException, self).__init__(prefix + ' ' + msg)
[docs]class NotImplementedException(Exception): def __init__(self, msg): prefix = '[Not Implemented]' super(NotImplementedException, self).__init__(prefix + ' ' + msg)