From: Gabriel Filion Date: Thu, 4 Sep 2014 06:53:14 +0000 (-0400) Subject: save: catch and log SSH errors X-Git-Tag: 0.27-rc1~41 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=bup.git;a=commitdiff_plain;h=e9dd83a1fd86630e98d44a37a3deb48912c787c5;hp=7015580d094d7b53002728a393cf913461cef3d6 save: catch and log SSH errors Currently, if the ssh connection to the remote server fails, we get the server errors, then an ugly traceback that ends up saying "look at the errors above". It makes it look like the traceback is part of the errors that we need to look at, when in reality it's just an exception that's not handled correctly by bup-save. Signed-off-by: Gabriel Filion [rlb@defaultvalue.org: adjust commit summary] Reviewed-by: Rob Browning Tested-by: Rob Browning --- diff --git a/cmd/save-cmd.py b/cmd/save-cmd.py index fce9aad..b8e4f7a 100755 --- a/cmd/save-cmd.py +++ b/cmd/save-cmd.py @@ -74,7 +74,11 @@ if opt.name and opt.name.startswith('.'): o.fatal("'%s' is not a valid branch name" % opt.name) refname = opt.name and 'refs/heads/%s' % opt.name or None if opt.remote or is_reverse: - cli = client.Client(opt.remote) + try: + cli = client.Client(opt.remote) + except client.ClientError, e: + log('error: %s' % e) + sys.exit(1) oldref = refname and cli.read_ref(refname) or None w = cli.new_packwriter(compression_level=opt.compress) else: