From: Jay Freeman (saurik) Date: Sun, 10 Jan 2016 07:34:15 +0000 (-0800) Subject: Include stack trace when printing Java exceptions. X-Git-Tag: v0.9.590~9 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/dc15fe8ace017fdef39202474c1563c1ae0ae67a Include stack trace when printing Java exceptions. --- diff --git a/libcycript.cy b/libcycript.cy index 57e8894..8240a44 100644 --- a/libcycript.cy +++ b/libcycript.cy @@ -184,6 +184,26 @@ Java.on('setup', function() { this.put(key, value); }, }); + + $cy_set(java.lang.Throwable.prototype, { + toCYON: function() { + var message = this.getMessage(); + if (message == null) + message = ''; + else + message = message.toCYON(); + + let stack = this.getStackTrace(); + if (stack.length == 0) + stack = ''; + else { + stack = stack.join('\n '); + stack = ` /*\n ${stack} */`; + } + + return `new ${this.constructor.class.getName()}(${message})${stack}`; + }, + }); }); }