Patchwork [bitbake-devel] xmlrpc: Show a better error message for connection failures

login
register
mail settings
Submitter Richard Purdie
Date Oct. 4, 2013, 1:15 p.m.
Message ID <1380892536.18603.602.camel@ted>
Download mbox | patch
Permalink /patch/59257/
State New
Headers show

Comments

Richard Purdie - Oct. 4, 2013, 1:15 p.m.
Showing a traceback when unable to connect to a bitbake server is
rather ugly. This change allows us to show a sensible error message.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---

Patch

diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index 389327a..82c0e8d 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -354,9 +354,12 @@  class BitBakeXMLRPCClient(BitBakeBaseServer):
             s.close()
         except:
             return None
-        self.serverImpl = XMLRPCProxyServer(host, port)
-        self.connection = BitBakeXMLRPCServerConnection(self.serverImpl, (ip, 0), self.observer_only, featureset)
-        return self.connection.connect()
+        try:
+            self.serverImpl = XMLRPCProxyServer(host, port)
+            self.connection = BitBakeXMLRPCServerConnection(self.serverImpl, (ip, 0), self.observer_only, featureset)
+            return self.connection.connect()
+        except Exception as e:
+            bb.fatal("Could not connect to server at %s:%s (%s)" % (host, port, str(e)))
 
     def endSession(self):
         self.connection.removeClient()