lnwsgi/lnwsgi/exceptions.py

25 lines
674 B
Python
Executable File

class WebException(Exception):
def __init__(self, message, status = 500):
Exception.__init__( self, message )
self.status = status
class UnsupportedMediaType(WebException):
pass
class ParameterException(WebException):
def __init__(self, name):
WebException.__init__(self, "value of parameter [{0}] is unsupported".format(name))
class Unauthenticated(WebException):
def __init__(self, request):
WebException.__init__(self, "unauthorized to access {0}".format(request.path), status = 401)
class Unauthorized(WebException):
def __init__(self, request):
WebException.__init__(self, "unauthorized to access {0}".format(request.path), status = 403)