X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/89a95d4776098c0d70653eebdc4f455f2e8e341d..925360811f44b121001797130ca89fc777072ae7:/libcycript.cy?ds=inline 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}`; + }, + }); }); }