def api_error_handler(err_msg: str): try: yield except HTTPError as e: if EXTRA_OUT: log.exception(e) else: log.error(e) failure_msg(err_msg, do_exit=True)
def ping(): """Check can connect to the server.""" try: r = api.check_login() success_msg(f"Connected to {c.config.server} as {r.username}") except HTTPError as e: failure_msg( f"Couldn't successfully connect to {c.config.server}, check your login details" ) log.error(e)
def ping(): """Check can connect to the server.""" try: api.ping() except HTTPError as e: log.error(e)