How to use the tomcatmanager.TomcatError function in tomcatmanager

To help you get started, we’ve selected a few tomcatmanager 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 tomcatmanager / tomcatmanager / tests / test_manager.py View on Github external
def failure_assertions(self, r):
        """
        Assertions for every command that should fail.
        """
        assert r.status_code == tm.status_codes.fail
        with pytest.raises(tm.TomcatError):
            r.raise_for_status()
github tomcatmanager / tomcatmanager / src / tomcatmanager / interactive_tomcat_manager.py View on Github external
def docmd(self, func: Callable, *args, **kwargs) -> Any:
        """Call a function and return, printing any exceptions that occur

        Sets exit_code to 0 and calls {func}. If func throws a TomcatError,
        set exit_code to 1 and print the exception
        """
        self.exit_code = self.exit_codes.success
        r = func(*args, **kwargs)
        try:
            r.raise_for_status()
        except tm.TomcatError as err:
            self.exit_code = self.exit_codes.error
            self.perror(str(err))
        return r