Get ( Call Stack ), aka Script Stack or Stack Trace

Idea created by Chris Irvine on Oct 27, 2015
    Active
    Score76

    Calling this function would simply output the information we currently see in the "Call Stack" section of the script debugger. This command would be useful to advanced developers. There may be complex situations or recursion that makes errors hard to track down. If an error is detected in a script, it could be very helpful to capture the output of this command and then phone home or write it in a log somewhere.

     

    Additional Considerations

     

    Vital Information

    • File Name
    • Script Name
    • Script Parameters
    • Single Step / Buttons / Triggers should be included, just like they are in the debugger.

    Large & Complex Parameters

    Script Parameters might be very large or encoded with rich data. Might I suggest truncating at 200 characters. Also, we don't want carriage returns in the parameter to pass directly through. Maybe escape or substitute spaces. ValueCount ( Get ( CallStack ) ) should always produce the depth of the call stack.

    Security

    Some files are protected and need to remain secure. Script Names and Parameters may be sensitive. If this function is evaluated inside the context of a file that does not have permission to reference a file farther up the call stack, then I'm afraid that the script name, and probably also the parameters need to be masked out. The called script running with [Full Access] should not trump this protection.

     

    Added 2017-02-08: One additional piece of information would be very useful, the script line number for each stack frame.