ソースを参照

Merge pull request #350 from ThomasWaldmann/fix-307

prettier connection closed message, fixes #307
TW 9 年 前
コミット
f651b014e6
1 ファイル変更5 行追加1 行削除
  1. 5 1
      borg/remote.py

+ 5 - 1
borg/remote.py

@@ -23,6 +23,10 @@ class ConnectionClosed(Error):
     """Connection closed by remote host"""
     """Connection closed by remote host"""
 
 
 
 
+class ConnectionClosedWithHint(ConnectionClosed):
+    """Connection closed by remote host. {}"""
+
+
 class PathNotAllowed(Error):
 class PathNotAllowed(Error):
     """Repository path not allowed"""
     """Repository path not allowed"""
 
 
@@ -148,7 +152,7 @@ class RemoteRepository:
         try:
         try:
             version = self.call('negotiate', 1)
             version = self.call('negotiate', 1)
         except ConnectionClosed:
         except ConnectionClosed:
-            raise Exception('Server immediately closed connection - is Borg installed and working on the server?')
+            raise ConnectionClosedWithHint('Is borg working on the server?')
         if version != 1:
         if version != 1:
             raise Exception('Server insisted on using unsupported protocol version %d' % version)
             raise Exception('Server insisted on using unsupported protocol version %d' % version)
         self.id = self.call('open', location.path, create)
         self.id = self.call('open', location.path, create)