Handle a unspecified exception and return the correct method that should be used
        for handling it.

        If the exception has the `can_redirect` property set to False, it is
        rendered to the browser.  Otherwise, it will be redirected to the location
        provided in the `RedirectUri` object that is associated with the request.

def handle_exception(self, exception):
        """
        Handle a unspecified exception and return the correct method that should be used
        for handling it.

        If the exception has the `can_redirect` property set to False, it is
        rendered to the browser.  Otherwise, it will be redirected to the location
        provided in the `RedirectUri` object that is associated with the request.
        """

        can_redirect = getattr(exception, "can_redirect", True)
        redirect_uri = getattr(self, "redirect_uri", None)

        if can_redirect and redirect_uri:
            return self.redirect_exception(exception)
        else:
            return self.render_exception(exception)