Mercurial > libervia-backend
diff src/bridge/DBus.py @ 751:1def5b7edf9f
core, bridge: better GenericException handling
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 17 Dec 2013 00:56:39 +0100 |
parents | d731ae066158 |
children | f49945d728de |
line wrap: on
line diff
--- a/src/bridge/DBus.py Mon Dec 16 17:49:54 2013 +0100 +++ b/src/bridge/DBus.py Tue Dec 17 00:56:39 2013 +0100 @@ -56,8 +56,13 @@ class GenericException(dbus.DBusException): def __init__(self, twisted_error): super(GenericException, self).__init__() - mess = twisted_error.getErrorMessage() - self._dbus_error_name = const_ERROR_PREFIX + "." + (mess or str(twisted_error.__class__)) + try: + error_name = str(twisted_error.value().__class__.__name__) + # twisted_error.value is a class + except TypeError: + # twisted_error.value is an instance + error_name = str(twisted_error.value.__class__.__name__) + self._dbus_error_name = const_ERROR_PREFIX + "." + error_name class DbusObject(dbus.service.Object):