diff --git a/cccli/cli.py b/cccli/cli.py index 6607a0bce8aaa31db202214d617015a7100c2595..2a14df271dbc01b7e9157860b7c615da0ecb225a 100644 --- a/cccli/cli.py +++ b/cccli/cli.py @@ -57,15 +57,19 @@ class Cli(object): def _connect(self): self.printer.debug("Connecting...") - rpcc = SimpleRpcClient.from_addr(self.settings["server"], - self.settings["port"], - enable_ssl=True, - default_handler=CliHandler(), - on_disconnect="quit", - timeout=self.settings["timeout"] + try: + rpcc = SimpleRpcClient.from_addr(self.settings["server"], + self.settings["port"], + enable_ssl=True, + default_handler=CliHandler(), + on_disconnect="quit", + timeout=self.settings["timeout"] ) - rpcc.start(daemonize=True) - self.rpc = ConnectionProxy(rpcc) + rpcc.start(daemonize=True) + self.rpc = ConnectionProxy(rpcc) + except Exception: + raise cliError("Connection failure!") + self.printer.debug("Connected.") def _auth(self): '''Handle server authentification'''