Getting the stack trace of an error
when catch error, able log stack trace. far i’ve come little trick:
error.prototype.tostring = function() { if (typeof this.stack === "undefined" || this.stack === null) { this.stack = "placeholder"; // previous line needed because next line may indirectly call method. this.stack = $.stack; } return "error"; }
this attaches stack manually-created error. example, can run:
try { throw new error("i'm error."); } catch (e) { $.writeln("stack: " + e.stack); }
and print correct stack error. however, works errors create. there way stack trace of error?
full disclosure: i’ve asked on stack overflow without success. see here more info: http://stackoverflow.com/questions/16201574/getting-the-stack-trace-of-an-error-in-extends cript
hei!
in extendscript there problems when extending objects. not sure error 1 of them, problem sure looks that.
here great source of info:
More discussions in InDesign Scripting
adobe
Comments
Post a Comment