ArmaDebugEngine icon indicating copy to clipboard operation
ArmaDebugEngine copied to clipboard

Suggestion: onScriptError

Open Sparker95 opened this issue 4 years ago • 1 comments

Hi!

Since you've asked, I'm making an issue.

Suggestion: add an SQF command: ADE_onScriptError code, which would call my code passed to it on a script error.

It should pass information about the script error to the callback, such as: file, line number, error text, and the callstack itself in string or array form.

Further things to think of: should it be stackable? What if we register the same code variable multiple times?

Sparker95 avatar Sep 11 '19 13:09 Sparker95

should it be stackable?

Honestly I'd just do a single handler thing. Otherwise I need to add tracking, and cleanup, and the ability to remove handlers and handler IDs and ugh.

Returns array callstack [ [file, line, local variables], [file, line, [["va1",val1], ["var2",val2]]], ... ] Order will be either top->bottom or bottom->top whatever is easier. It will still print to RPT. For the local variables we might want to think about making a deep copy of the array after it was built. If the local vars reference arrays they might change between error and the onScriptError handler. Also the handler needs to be spawned as we can't interfere with the script vm while it's processing a error.

dedmen avatar Sep 12 '19 10:09 dedmen