Running Keyboard Maestro 9.0.5 on macOS 10.14.6 (Mojave).
@peternlewis, it appears to me that the KM Engine Log entries when there is an AppleScript error are malformed and incomplete.
Example KM Engine Log
2020-05-25 20:40:33 Execute macro “TEST Macro Error Handling of Script Error @TEST” from trigger Duplicate Macro Palette
2020-05-25 20:40:33 text-script:939:952: execution error: [Script ERROR] Can’t divide 5.0 by zero. SCRIPT: “Create Script Error” 1.1 (-2700)
2020-05-25 20:40:33 text-script:939:952: execution error: [Script ERROR] Can’t divide 5.0 by zero. SCRIPT: “Create Script Error” 1.1 (-2700)
Macro “TEST Macro Error Handling of Script Error @TEST” cancelled (while executing SCRIPT: Cause a Script Error (AS)).
Issues
- There is a blank line in the middle of the error logs
- The line reporting the Macro cancellation does NOT have a time stamp:
Macro “TEST Macro Error Handling of Script Error @TEST” cancelled (while executing SCRIPT: Cause a Script Error (AS)).
The format/layout of the log for an Execute Script Action is quite different than other Actions, which generally look like this:
2020-05-25 20:57:19 Execute macro “TEST for Proper Logging of Search Action with Regex @TEST” from trigger Duplicate Macro Palette
2020-05-25 20:57:19 Search Regular Expression failed to match (.+) NotFound (.+)
2020-05-25 20:57:19 Search Regular Expression failed to match (.+) NotFound (.+) Macro “TEST for Proper Logging of Search Action with Regex @TEST” cancelled (while executing RegEx: Example Regex that fails -- Notify and Terminate ON).
It would be very helpful, for both manual and automated, analysis of KM Error logs if the format/layout of the failure of an Action was consistent for all Actions.
At a bare minimum, I would request that you add the time stamp, and removed the blank line.
But something like this would be great!
~~~ If the script was a script text: ~~~
2020-05-25 20:40:33 Execute AppleScript failed with “[Script ERROR] Can’t divide 5.0 by zero.” in text-script. Macro “TEST Macro Error Handling of Script Error @TEST” cancelled (while executing SCRIPT: Cause a Script Error (AS)).
~~~ If the script was a script file: ~~~
2020-05-25 20:40:33 Execute AppleScript failed with “[Script ERROR] Can’t divide 5.0 by zero.” in /path/to/script/Create Script Error.scpt. Macro “TEST Macro Error Handling of Script Error @TEST” cancelled (while executing SCRIPT: Cause a Script Error (AS)).
Just to be clear, and maybe a bit helpful, this is the format:
<Date/Time> <Action Type> failed with “<Error Msg>” in <Source>. Macro “<Macro Name>” cancelled (while executing “<Action Name>”)
I added a few fancy quotes that you have not been using, which helps make the variable info clear.
Thanks.