]> git.saurik.com Git - cycript.git/blobdiff - libcycript.cy
Allow injection as thread in running Java process.
[cycript.git] / libcycript.cy
index 57e8894a79ba7efaf966f597360dd424514a2e73..8240a44def2fb362e88748f0557aed905e750d9c 100644 (file)
@@ -184,6 +184,26 @@ Java.on('setup', function() {
                 this.put(key, value);
         },
     });
                 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}`;
+        },
+    });
 });
 
 }
 });
 
 }