Skip to content

Instantly share code, notes, and snippets.

@lucemia
Created December 28, 2013 14:38
Show Gist options
  • Select an option

  • Save lucemia/8160124 to your computer and use it in GitHub Desktop.

Select an option

Save lucemia/8160124 to your computer and use it in GitHub Desktop.
# api_exceptions.py
class BadRequestException(ServiceException):
"""Bad request exception that is mapped to a 400 response."""
http_status = httplib.BAD_REQUEST
class ForbiddenException(ServiceException):
"""Forbidden exception that is mapped to a 403 response."""
http_status = httplib.FORBIDDEN
class InternalServerErrorException(ServiceException):
"""Internal server exception that is mapped to a 500 response."""
http_status = httplib.INTERNAL_SERVER_ERROR
class NotFoundException(ServiceException):
"""Not found exception that is mapped to a 404 response."""
http_status = httplib.NOT_FOUND
class UnauthorizedException(ServiceException):
"""Unauthorized exception that is mapped to a 401 response."""
http_status = httplib.UNAUTHORIZED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment