bridge: DBusException also transports the twisted failure condition
This commit is contained in:
parent
8867ac6c60
commit
bba25dd62d
1 changed files with 45 additions and 5 deletions
|
|
@ -57,6 +57,11 @@ class DeferredNotAsync(dbus.DBusException):
|
|||
|
||||
class GenericException(dbus.DBusException):
|
||||
def __init__(self, twisted_error):
|
||||
"""
|
||||
|
||||
@param twisted_error (Failure): instance of twisted Failure
|
||||
@return: DBusException
|
||||
"""
|
||||
super(GenericException, self).__init__()
|
||||
try:
|
||||
# twisted_error.value is a class
|
||||
|
|
@ -64,7 +69,11 @@ class GenericException(dbus.DBusException):
|
|||
except TypeError:
|
||||
# twisted_error.value is an instance
|
||||
class_ = twisted_error.value.__class__
|
||||
self.args = (twisted_error.getErrorMessage(),)
|
||||
message = twisted_error.getErrorMessage()
|
||||
try:
|
||||
self.args = (message, twisted_error.value.condition)
|
||||
except AttributeError:
|
||||
self.args = (message,)
|
||||
self._dbus_error_name = '.'.join([const_ERROR_PREFIX, class_.__module__, class_.__name__])
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue