summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2011-08-31 15:13:33 +0200
committerJelmer Vernooij <jelmer@samba.org>2011-08-31 15:13:33 +0200
commit06647385086ef3a2b31d647bb61e98d7f2086b48 (patch)
tree274ebcb2a73d300dfaf050940ac93590f4a4eef6
parent670c8e9426c6f0dd5f1edacd15b554b7d94745a7 (diff)
Catch exceptions when creating connection.
-rw-r--r--bzr/__init__.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/bzr/__init__.py b/bzr/__init__.py
index d21c05f..0d73b16 100644
--- a/bzr/__init__.py
+++ b/bzr/__init__.py
@@ -48,12 +48,17 @@ def get_client():
from zeitgeist.client import ZeitgeistClient
except ImportError:
_client = None
- except RuntimeError, e:
- trace.info("Unable to connect to Zeitgeist, won't send events."
- "Reason: '%s'" % e)
- _client = None
- else:
+ return _client
+ import dbus
+ try:
_client = ZeitgeistClient()
+ except dbus.DBusException, e:
+ trace.warning("zeitgeist: %s. No events will be sent." % e.message)
+ _client = None
+ except Exception, e:
+ trace.warning("Unable to connect to Zeitgeist, won't send events. "
+ "Reason: '%s'" % e)
+ _client = None
return _client