Page MenuHomeFeedback Tracker

OnScriptError event handler
New, NormalPublic

Description

With OnScriptError event handler tool makers could collect and display the script errors in new and better ways. For example one could create a window that shows all the errors raised

Example of such event handler:

addMissionEventHandler ["OnScriptError",
{
 params ["_errorMsg","_file","_line"];

}];

The event would be called every time there is a script error

Details

Severity
Feature
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
Scripting

Event Timeline

gc8 created this task.Nov 15 2021, 5:23 PM
gc8 updated the task description. (Show Details)
gc8 added a comment.Nov 18 2021, 5:56 PM

Example of what kind of error dialog could be achieved by this feature:

dedmen set Ref Ticket to AIII-55256.Jul 6 2022, 2:39 PM
gc8 added a comment.EditedJul 6 2022, 6:32 PM

stack trace would also be good with this, with variables also. like in diag_stacktrace

h- added a subscriber: h-.Jul 7 2022, 7:40 AM
gc8 updated the task description. (Show Details)Jul 7 2022, 1:45 PM
debug added a subscriber: debug.Mar 11 2023, 7:05 PM

I am not expecting anything but i think it would be neat to have the following feature(s) added to the scripterror event handler:
the handler runs in an overall catch block that redirects the error message from it's default behavior. this is accomplished by not displaying the error message on screen unless one's return value is a string with said error he/she would like to be printed. additionally, one can return value false or true to change the handling of the script as either a continue execution (true) or breakpoint (false) such that he or she can handle the error gracefully (like in the case of code that could cause problems if the code continues with errors). this would give modders the ability to turn off error messages by event this event handler just returning true or saving the errors into a variable for later parsing and analysis or redirecting to the log file or showing the error in the systemchat, etc.