There really is no way to get the stack or even print the line number programmatically. When an error is generated, only the line number can be seen. At best, you can get an error code and description, or you can make your own mistakes.
Here is the documentation .
And an example
try { produceAnError(); } catch(e) { WScript.echo((e.number>>16 & 0x1FFF));
Aerze source share