How to use the janus.exceptions.JanusException function in janus

To help you get started, we’ve selected a few janus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xamoom / xamoom-janus / janus / exceptions.py View on Github external
meta=meta)

class NotFoundException(JanusException):
    """
    represents a not found exception (HTTP 404)
    """
    def  __init__(self, detail=None, code=-1, meta = None):
        #just call super with some prefilled information fitting this special type of exception
        JanusException. __init__(self,
            title="The requested resource could not be found but may be available again in the future. Subsequent requests by the client are permissible.",
            detail=detail,
            status=404,
            code=code,
            meta=meta)

class DeveloperException(JanusException):
    """
    represents an Exception caused by Developer Error
    """
    def  __init__(self, title="Developer Error", detail=None, code=-1, meta = None, status = 500):
        #just call super with some prefilled information fitting this special type of exception
        JanusException. __init__(self,
            title=title,
            detail=detail,
            status=500,
            code=code,
            meta=meta)

class InternalServerErrorException(JanusException):
    """
    represents a Internal Server Error exception (HTTP 500)
    """
github xamoom / xamoom-janus / janus / exceptions.py View on Github external
meta=meta)

class DeveloperException(JanusException):
    """
    represents an Exception caused by Developer Error
    """
    def  __init__(self, title="Developer Error", detail=None, code=-1, meta = None, status = 500):
        #just call super with some prefilled information fitting this special type of exception
        JanusException. __init__(self,
            title=title,
            detail=detail,
            status=500,
            code=code,
            meta=meta)

class InternalServerErrorException(JanusException):
    """
    represents a Internal Server Error exception (HTTP 500)
    """
    def  __init__(self, detail=None, meta = None):
        #just call super with some prefilled information fitting this special type of exception
        JanusException. __init__(self,
            title="Internal Server Error",
            detail=detail,
            status=500,
            code="42", #this is always error 42, because this should never happen on production.
            meta=meta)
github xamoom / xamoom-janus / janus / exceptions.py View on Github external
meta=meta)

class UnauthorizedException(JanusException):
    """
    represents a Unauthorized exception (HTTP 401)
    """
    def  __init__(self, detail=None, code=-1, meta = None):
        #just call super with some prefilled information fitting this special type of exception
        JanusException. __init__(self,
            title="The request can not be process, because authorization is missing.",
            detail=detail,
            status=401,
            code=code,
            meta=meta)

class ForbiddenException(JanusException):
    """
    represents a Forbidden exception (HTTP 403)
    """
    def  __init__(self, detail=None, code=-1, meta = None):
        #just call super with some prefilled information fitting this special type of exception
        JanusException. __init__(self,
            title="You are not allowed to access this resource.",
            detail=detail,
            status=403,
            code=code,
            meta=meta)

class NotFoundException(JanusException):
    """
    represents a not found exception (HTTP 404)
    """
github xamoom / xamoom-janus / janus / exceptions.py View on Github external
meta=meta)

class ForbiddenException(JanusException):
    """
    represents a Forbidden exception (HTTP 403)
    """
    def  __init__(self, detail=None, code=-1, meta = None):
        #just call super with some prefilled information fitting this special type of exception
        JanusException. __init__(self,
            title="You are not allowed to access this resource.",
            detail=detail,
            status=403,
            code=code,
            meta=meta)

class NotFoundException(JanusException):
    """
    represents a not found exception (HTTP 404)
    """
    def  __init__(self, detail=None, code=-1, meta = None):
        #just call super with some prefilled information fitting this special type of exception
        JanusException. __init__(self,
            title="The requested resource could not be found but may be available again in the future. Subsequent requests by the client are permissible.",
            detail=detail,
            status=404,
            code=code,
            meta=meta)

class DeveloperException(JanusException):
    """
    represents an Exception caused by Developer Error
    """
github xamoom / xamoom-janus / janus / exceptions.py View on Github external
self.meta = meta

        #we use a string representation of all we got in details plus timestamp as hash to identify this error.
        #So we can search for it in the logs, if we need to.
        self.id = hashlib.sha1(
                                (
				str(time.time()) +
                                str(self.title) +
                                str(self.detail) +
                                str(self.status) +
                                str(self.code) +
                                str(self.meta)
				).encode('utf-8')
                              ).hexdigest()

class BadRequestException(JanusException):
    """
    represents a Bad Request exception (HTTP 400)
    """
    def __init__(self, detail=None, code=-1, meta = None):
        JanusException. __init__(self,
            title="The web server was unable to understand the request and process it.",
            detail=detail,
            status=400,
            code=code,
            meta=meta)

class UnauthorizedException(JanusException):
    """
    represents a Unauthorized exception (HTTP 401)
    """
    def  __init__(self, detail=None, code=-1, meta = None):
github xamoom / xamoom-janus / janus / exceptions.py View on Github external
).encode('utf-8')
                              ).hexdigest()

class BadRequestException(JanusException):
    """
    represents a Bad Request exception (HTTP 400)
    """
    def __init__(self, detail=None, code=-1, meta = None):
        JanusException. __init__(self,
            title="The web server was unable to understand the request and process it.",
            detail=detail,
            status=400,
            code=code,
            meta=meta)

class UnauthorizedException(JanusException):
    """
    represents a Unauthorized exception (HTTP 401)
    """
    def  __init__(self, detail=None, code=-1, meta = None):
        #just call super with some prefilled information fitting this special type of exception
        JanusException. __init__(self,
            title="The request can not be process, because authorization is missing.",
            detail=detail,
            status=401,
            code=code,
            meta=meta)

class ForbiddenException(JanusException):
    """
    represents a Forbidden exception (HTTP 403)
    """