Since I haven't caught any error conditions before, I would like to ask: How and where to add a condition for an error message that the source term isn't present in the glossary yet?
This kind of "Search with Regular Expression" error happens because there's no match to the pattern you are searching for -- how you handle that depends on whether that matters!
If you are happy to have the capture group variable not be set -- so it retains its previously set value, or remains "empty" if not previously used -- you can simply turn off "Failure Aborts Macro" in the action's Options. In this example I've left "Notify on Failure" on so you can see it does indeed fail:
If you run it as-is you'll see that the search errors and Local__theWord retains its previous value. If you disable the first action so Local__theWord is never set you'll see it resolves to an empty string in the "Display" action.
So you could use this method -- either directly if you are happy to have an empty string, or by testing "If...Local__theWord is empty" and doing something based on that:
If you want something more "formal" you can use a "Try/Catch" block. Note that in this case you leave "Failure Aborts Macro" enabled and it's the "Try" block that catches the error and stops the macro from aborting -- you don't even get a notification:
...and again you'll see that you get a "Failed!" dialog from the "Catch" but the macro continues to the end, with an empty string where the %Variable%Local__theWord% token is used.
As you can see, there's no "one size fits all" answer -- but there's plenty of options!
Anyway, perhaps your clear explanation can be the basis of a Wiki article, written from the user perspective (I want to catch an error, which action should I use?)?
If you simply search the Wiki for "error" the hit list is big and hard to navigate. You can search for multiple criteria such as "error action", although this again creates a big hit list.
Unknown to most users is the Search Tools button with which you can further drill down to a more easily managed hit list:
I’ve never noticed that @ccstone even though I search the wiki a lot. This is a tip that’ll just save me even more time by reducing the endless lists of search hits I always seem to get😀 great advice re Google search too. Thanks!