]> arthur.barton.de Git - bup.git/commitdiff
save: catch and log SSH errors
authorGabriel Filion <gabster@lelutin.ca>
Thu, 4 Sep 2014 06:53:14 +0000 (02:53 -0400)
committerRob Browning <rlb@defaultvalue.org>
Thu, 11 Sep 2014 19:33:10 +0000 (14:33 -0500)
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 <gabster@lelutin.ca>
[rlb@defaultvalue.org: adjust commit summary]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
cmd/save-cmd.py

index fce9aadc95659c36014c3032df309e865bb257aa..b8e4f7aa597d999d877a31a40b36f4c40e205a71 100755 (executable)
@@ -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: