online-desktop r7269 - trunk/pyddm/ddm



Author: marinaz
Date: Mon Oct 20 21:58:41 2008
New Revision: 7269
URL: http://svn.gnome.org/viewvc/online-desktop?rev=7269&view=rev

Log:
Unpack the Exception returned by a dbus call to get the actual error message.


Modified:
   trunk/pyddm/ddm/DataModel.py

Modified: trunk/pyddm/ddm/DataModel.py
==============================================================================
--- trunk/pyddm/ddm/DataModel.py	(original)
+++ trunk/pyddm/ddm/DataModel.py	Mon Oct 20 21:58:41 2008
@@ -254,13 +254,12 @@
         self._on_success(result)
 
     def __on_query_error(self, err):
-        # FIXME: As of dbus-python-0.80, exception handling for is very, very, limited
-        # all we get is the message, so we can't do anything special for the defined
-        # DataModel errors. This is fixed in later versions of dbus-python, where we can
-        # get the exception type and the args
-        #
-        _logger.error('Caught error: %s', err.message)
-        self._on_error(ERROR_FAILED, err.message)
+        error_message, error_code = err # this unpacks args from the Exception
+        _logger.error('Caught error: %s code: %s', error_message, error_code)
+        # we are using ERROR_FAILED instead of the error_code here because that seems to be
+        # more predictable and allows us to distinguish query error from ERROR_NO_CONNECTION
+        # below
+        self._on_error(ERROR_FAILED, error_message)
 
     def __async_no_connection_error(self):
         self._on_error(ERROR_NO_CONNECTION, "No connection to engine to data model engine")



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]