Skip to content

exceptions

Route custom exceptions.

Attributes

Classes

ServerException(message, exception_type, exception_traceback)

Bases: Exception

Server error.

Source code in pyrevitlib/pyrevit/routes/server/exceptions.py
def __init__(self, message, exception_type, exception_traceback):
    message = "Server error (%s): %s\n%s\n" % (
        exception_type.__name__ if exception_type else "",
        message,
        exception_traceback
    )
    super(ServerException, self).__init__(message)
    self.status = 500 # https://httpstatuses.com/500

Attributes

status = 500 instance-attribute

APINotDefinedException(api_name)

Bases: Exception

API is not defined exception.

Source code in pyrevitlib/pyrevit/routes/server/exceptions.py
def __init__(self, api_name):
    message = "API is not defined: \"%s\"" % api_name
    super(APINotDefinedException, self).__init__(message)
    self.status = 404 # https://httpstatuses.com/404

Attributes

status = 404 instance-attribute

RouteHandlerNotDefinedException(api_name, route, method)

Bases: Exception

Route does not exits exception.

Source code in pyrevitlib/pyrevit/routes/server/exceptions.py
def __init__(self, api_name, route, method):
    message = \
    "Route does not exits: \"%s %s%s\"" % (method, api_name, route)
    super(RouteHandlerNotDefinedException, self).__init__(message)
    self.status = 404 # https://httpstatuses.com/404

Attributes

status = 404 instance-attribute

RouteHandlerDeniedException(request)

Bases: Exception

Route handler was denied by host.

Source code in pyrevitlib/pyrevit/routes/server/exceptions.py
def __init__(self, request):
    message = "Route handler was denied by host: \"%s\"" % request.route
    super(RouteHandlerDeniedException, self).__init__(message)
    self.status = 406 # https://httpstatuses.com/406
    self.source = HOST_APP.pretty_name

Attributes

status = 406 instance-attribute
source = HOST_APP.pretty_name instance-attribute

RouteHandlerTimedOutException(request)

Bases: Exception

Route handler was timed out by host.

Source code in pyrevitlib/pyrevit/routes/server/exceptions.py
def __init__(self, request):
    message = "Route handler was timed out by host: \"%s\"" % request.route
    super(RouteHandlerTimedOutException, self).__init__(message)
    self.status = 408 # https://httpstatuses.com/408
    self.source = HOST_APP.pretty_name

Attributes

status = 408 instance-attribute
source = HOST_APP.pretty_name instance-attribute

RouteHandlerIsNotCallableException(hndlr_name)

Bases: Exception

Route handler is not callable.

Source code in pyrevitlib/pyrevit/routes/server/exceptions.py
def __init__(self, hndlr_name):
    message = "Route handler is not callable: \"%s\"" % hndlr_name
    super(RouteHandlerIsNotCallableException, self).__init__(message)
    self.status = 405 # https://httpstatuses.com/405
    self.source = HOST_APP.pretty_name

Attributes

status = 405 instance-attribute
source = HOST_APP.pretty_name instance-attribute

RouteHandlerExecException(message)

Bases: Exception

Route handler exception.

Source code in pyrevitlib/pyrevit/routes/server/exceptions.py
def __init__(self, message):
    message = "Route exception in Execute: %s" % message
    super(RouteHandlerExecException, self).__init__(message)
    self.status = 408 # https://httpstatuses.com/408
    self.source = HOST_APP.pretty_name

Attributes

status = 408 instance-attribute
source = HOST_APP.pretty_name instance-attribute

RouteHandlerException(message, exception_type, exception_traceback, clsx_message, clsx_source, clsx_stacktrace, clsx_targetsite)

Bases: Exception

Route handler exception.

Source code in pyrevitlib/pyrevit/routes/server/exceptions.py
def __init__(self,
             message, exception_type, exception_traceback,
             clsx_message, clsx_source, clsx_stacktrace, clsx_targetsite):
    message = "%s: %s\n%s\n" \
              "Script Executor Traceback:\n" \
              "%s: %s\n%s\n%s" % (
                  exception_type.__name__ if exception_type else "",
                  message,
                  exception_traceback,
                  clsx_source,
                  clsx_message,
                  clsx_stacktrace,
                  clsx_targetsite
              )
    super(RouteHandlerException, self).__init__(message)
    self.status = 408 # https://httpstatuses.com/408
    self.source = HOST_APP.pretty_name

Attributes

status = 408 instance-attribute
source = HOST_APP.pretty_name instance-attribute