Okay, I think I'm making some sort of progress here and I think it might be in how I'm using ESTK...
I found the following script after scouring Google and StackOverflow:
Code: Select all
Error.prototype.toString = function() {
if (typeof this.stack === "undefined" || this.stack === null) {
this.stack = "placeholder";
// The previous line is needed because the next line may indirectly call this method.
this.stack = $.stack;
}
return "Error";
}
try {
var foo = null;
foo.bar;
}
catch (e) {
$.writeln("Line: " + e.line);
$.writeln("File: " + e.fileName);
$.writeln("Message: " + e.message);
$.writeln("Stack: " + e.stack);
}
Since this piece of code appeared to expose the line number in the catch block, I went ahead and quickly plopped it into my script to test it out. ESTK halted / broke processing on the line "foo.bar" line due to seeing that "null is not an object."
But here's where it gets interesting...
Normally, I'd press the "STOP" button in ESTK to make processing stop, but when I press the "PLAY" button to keep going without clearing the runtime error (pressing NO on the ESTK "Clear runtime error?" prompt, I mean), I FINALLY see line number information, only the line number reflects the foo.bar line.
So I think I must be using ESTK incorrectly or at least in such a way that prevents me from seeing or exposing the line number information as the above works, just not the way I want.
I need to find a way to basically dump the line number on a line I choose in my script and hopefully without needing to manually tell ESTK to disregard runtime errors, etc. Simply put, I'm looking for the same functionality you have with the "__LINE__" magic constant in PHP, only in this ExtendScript, and hopefully without needing to force ESTK to halt processing and be forced to manually disregard a runtime error just to dump the line info...