From 9e85a60e4b0868dd9bd92b10e08fc1f6b7025516 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 21 Dec 2015 06:25:50 -0800 Subject: [PATCH] Print the sort-of stack trace from JavaScriptCore. --- libcycript.cy | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libcycript.cy b/libcycript.cy index 6a751aa..4e4a49e 100644 --- a/libcycript.cy +++ b/libcycript.cy @@ -33,7 +33,12 @@ $cy_set(Date.prototype, { $cy_set(Error.prototype, { toCYON: function() { - return `new ${this.constructor.name}(${this.message.toCYON()})`; + let stack = this.stack.split('\n'); + if (stack.slice(-1)[0] == "global code") + stack = stack.slice(0, -1); + for (let i = 0; i != stack.length; ++i) + stack[i] = '\n ' + stack[i]; + return `new ${this.constructor.name}(${this.message.toCYON()}) /*${stack.join('')} */`; }, }); -- 2.49.0