You need to quickly get the error details, and edit the Macro to fix it
KM native reporting of Macro errors via the macOS Notification Center is very poor
(sorry @peternlewis, but it's true)
The below Macro attempts to provide better error reporting
However, because KM does NOT use a consistent format for logging errors, this Macro may not find all errors
If your Macro has an error that the Macro does NOT find, please post details in a reply. See instructions at bottom of this post. I will try to update the macro to catch your error.
PURPOSE
Display Detailed Info about Last Macro Error
With Options to
Edit Macro with Error and Search for Action that caused the error
Display KME Log file
Display Last N Lines from Log using BBEdit
Note: This Macro is Not Perfect
Because KM does NOT output all Macro errors in a consistent format, I have had to make an educated guess on the error format.
As a result, I expect there are some macro errors that will not be found by this Macro.
If you encounter an error not found by this Macro, please report it here.
See the below section for details: "Reporting Macro Errors Not Found By This Macro"
MACRO:Â Â Â Display Last KM Macro Error Ver 4 [Pub]
UPDATED: 2021-07-21 17:30 GMT-5
Ver 4.4 provides a much enhanced output of the KM Log to BBEdit
-~~~ VER: 4.4Â Â Â Â 2021-07-21 ~~~ Requires: KM 8.2.4+Â Â Â macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))
KM does NOT use a consistent format for logging errors, so this Macro may not find some errors
If your Macro has an error that the Macro does NOT find, please post details in a reply.
Post the lines from the KM Error log shown in BBEdit that include all lines that contain the error information about your error, and two lines above and below them.
2020-07-03 13:09:39 Variable âKMVAR_TEST__PageSourceâ excluded from environment to ensure the environment is not too large
2020-07-03 13:09:39 Execute macro âDisplay Last KM Macro Error Ver 4 SIMPLEâ from trigger The Hot Key ââ„âE is pressed
2020-07-03 13:09:33 Execute an AppleScript failed with script error: /Users/jimunderwood/Documents/My KM Data/Scripts/Extract Author and Article Title from EWT EMail.scpt: execution error: [ERROR] [MACRO CANCELLED] NSRegularExpression doesnât understand the âregularExpressionWithPattern_options_error_â message. (-2700)
2020-07-03 13:09:32 Variable âKMVAR_DiscussionTextâ excluded from environment to ensure the environment is not too large
2020-07-03 13:09:32 Variable âKMVAR_TEST__PageSourceâ excluded from environment to ensure the environment is not too large
2020-07-03 13:09:32 Variable âKMVAR_DiscussionTextâ excluded from environment to ensure the environment is not too large
2020-07-03 13:09:32 Variable âKMVAR_TEST__PageSourceâ excluded from environment to ensure the environment is not too large
2020-07-03 13:09:32 Execute macro âFWD Selected EMail to @Evernote @EN @OLâ from trigger The Hot Key ââ§E is pressed
2020-07-03 13:09:21 Execute an AppleScript failed with script error: /Users/jimunderwood/Documents/My KM Data/Scripts/Extract Author and Article Title from EWT EMail.scpt: execution error: [ERROR] [MACRO CANCELLED] NSRegularExpression doesnât understand the âregularExpressionWithPattern_options_error_â message. (-2700)
2020-07-03 13:09:21 Variable âKMVAR_DiscussionTextâ excluded from environment to ensure the environment is not too large
Note I have added a blank line immediately above and below what looks like that actual error msg.
Sometimes you will find unrelated lines mixed in with your error lines.
Thanks for your help in identifying all of the error log formats.
Could you please confirm that all macro errors use this format, or, if not, provide the other formats?
If you have any suggestions on how to improve this, I'd love to hear/see them.
Thanks.
Example Log Entry
2016-10-27 12:51:12 Search Variable failed to match \d+ Macro âKM TEST Notificationsâ cancelled (while executing FORCE ERROR to Abort Macro and AutoLog).
I don't know. Log messages are plain text and could contain anything. There are around 800 places where log messages are printed. Most of them are debugging that is disabled by default. I've got no idea what other ones might be of interest I'm afraid, it isn't something I can support. If it works and finds what you're after now, that is as good a guarantee as you're going to get.
Am I correct in understanding that only entries containing "Executing macro" and "Running application" are filtered out, and all other entries should appear? My log has these recent entries:
2020-05-17 08:02:58 Open File failed with non-existent path â/x.txtâ.
2020-05-17 08:02:58 Open File failed with non-existent path â/x.txtâ. Macro âOpen x.txtâ cancelled (while executing Open â/x.txtâ).
When I trigger Display Last KM Macro Error, I get:
Can you help me understand why these failures are being filtered out/not being shown?
The problem is that there is not a standard format in which KM reports an error, failure, or termination to the log. I have asked @peternlewis to adopt one, but he declines to do so.
So I have had to make my best guess as to what constitutes an error, and extract the log entries accordingly.
Clearly my method is not perfect, and never will be until/if KM adopts a standard format.
If you, or anyone, can suggest a better method/regex I would be glad to incorporate it.
Hopefully my macro will be of help most of the time. I find how KM reports an error to the user to be lacking and frustrating. The macOS Notification is very limited, and often we can't read all of the error msg.
So if you have any suggestions for improvement, please let me know.
Thanks for the reply (and the macro). Actually, itâs helpful even to have the last five lines. I just wanted to make sure I understood. Sorry I canât offer anything helpful.
I've found this really, really useful thanks. The notifications that pop up are really frustrating as half the time the info is cut off by the notification format not allowing the full message. Maybe there's another way to see the whole message, but I found this first and it's excellent!
Jim - I don't know how I missed this macro before, but thanks - it's awesome!
Can I assume this is a typo - that the "period" is on a separate line?
I'm only asking because I know you sometimes do things on purpose that the reason isn't initially obvious (but ends up being a good reason!), so I wanted to double-check.
I should have guessed that - I've done the same thing. If memory serves, there's an unprintable character you can use instead, but I'll be darned if I can remember which one. Maybe I'm thinking of something else. Anyway, thanks again for the macro!
When you choose to open the KM Log in BBEdit, you will find a much more useful and easy to read window, with all of the "Execute Macro" lines highlighted.
Of course, when looking for an error, you need to start with the execution of the Macro, and, in this case, look UP (because the log is shown in reverse chron (last first) order) for the error details, which may NOT immediately follow the execution log entry.