From 19a8ea1fd3a072de2d8539fdcd3c6a126c11156a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Thu, 2 Jun 2016 14:28:33 +0200 Subject: [PATCH] Include stacktrace in RPC exception when available --- src/frida/core.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/frida/core.py b/src/frida/core.py index 9579c96..7ba03d1 100644 --- a/src/frida/core.py +++ b/src/frida/core.py @@ -342,7 +342,7 @@ class Script(object): if operation == 'ok': value = params[0] if data is None else data else: - error = Exception(params[0]) + error = RPCException(*params[0:2]) callback(value, error) @@ -371,6 +371,10 @@ class Script(object): else: print(text, file=sys.stderr) +class RPCException(Exception): + def __str__(self): + return self.args[1] if len(self.args) >= 2 else self.args[0] + class ScriptExports(object): def __init__(self, script): self._script = script