Now, how can I get the full error message? Clicking on it will not help (Peter: Couldn't you have the Notification handler of KM then display its own error dialog with the full message here?)
I figured out the issue that was causing the error by running the script in Script Debugger (I had missed to create a "Snippet - Temporary" group), but that doesn't solve the general problem of getting these cut-off error messages whenever there's an error in a script.
You can find the full message in the KM log file. AppleScript errors are down to AppleScript and not KM. so if you have an error in your AS you need to explore the AS documentation rather than the KM documents.
Hi JM,
how about a section titled "Error Handling", with text:
If the Applescript contains errors, a system notification will be displayed when the action is run (unless you have disabled them in System Preferences).
If a Notifications is displayed, it can happen the error message gets cut off.
To see the entire message, look into the log, which you can view by ...
Actually, I have trouble finding the log that would show me the applescript error. When I search for "log" in the Help menu, I only find Actions related to the log, but no command to actually view a log window or a log file.
Okay, so I now noticed the menu entry "Open Logs Folder" in the Help menu. The fact that searching for "log" or "logs" in the Help's search didn't reveal this can be written off as another bug in macOS, I guess.
And therein I found "Engine.log", with the Applescript errors I was looking for.
So, the Applescript Wiki page should probably point to this file, with the hint that using the "Open Logs Folder" in the Help menu will show that file.
#!/bin/bash
# Path to the log file
LOG_FILE="$HOME/Library/Logs/Keyboard Maestro/Engine.log"
# Get the most recent failed action
grep "Action .* failed" "$LOG_FILE" | tail -n 1