From 3a983b17db6efc4708478504dcd93545ddcbf7e3 Mon Sep 17 00:00:00 2001 From: Goffi Date: Mon, 8 Sep 2014 21:23:21 +0200 Subject: [PATCH] =?UTF-8?q?frontends=20(dbus):=20error=20is=20not=20trunca?= =?UTF-8?q?ted=20anymore=20if=20it's=20not=20a=20S=C3=A0T=20error.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontends/src/bridge/DBus.py | 6 +++++- src/bridge/bridge_constructor/dbus_frontend_template.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/frontends/src/bridge/DBus.py b/frontends/src/bridge/DBus.py index dce89993..77ede3e2 100644 --- a/frontends/src/bridge/DBus.py +++ b/frontends/src/bridge/DBus.py @@ -43,7 +43,11 @@ def dbus_to_bridge_exception(dbus_e): @param dbus_e (DBusException) @return: BridgeException """ - name = dbus_e.get_dbus_name()[len(const_ERROR_PREFIX) + 1:] + full_name = dbus_e.get_dbus_name() + if full_name.startswith(const_ERROR_PREFIX): + name = dbus_e.get_dbus_name()[len(const_ERROR_PREFIX) + 1:] + else: + name = full_name # XXX: dbus_e.args doesn't contain the original DBusException args, but we # receive its serialized form in dbus_e.args[0]. From that we can rebuild # the original arguments list thanks to ast.literal_eval (secure eval). diff --git a/src/bridge/bridge_constructor/dbus_frontend_template.py b/src/bridge/bridge_constructor/dbus_frontend_template.py index 3249dbbc..edafce05 100644 --- a/src/bridge/bridge_constructor/dbus_frontend_template.py +++ b/src/bridge/bridge_constructor/dbus_frontend_template.py @@ -43,7 +43,11 @@ def dbus_to_bridge_exception(dbus_e): @param dbus_e (DBusException) @return: BridgeException """ - name = dbus_e.get_dbus_name()[len(const_ERROR_PREFIX) + 1:] + full_name = dbus_e.get_dbus_name() + if full_name.startswith(const_ERROR_PREFIX): + name = dbus_e.get_dbus_name()[len(const_ERROR_PREFIX) + 1:] + else: + name = full_name # XXX: dbus_e.args doesn't contain the original DBusException args, but we # receive its serialized form in dbus_e.args[0]. From that we can rebuild # the original arguments list thanks to ast.literal_eval (secure eval).