The following Google Apps Script is designed to exercise how you might go about searching the error message in a 'try/catch' for keywords. I wanted this specifically for a tool I built that contains a lot of code (and hence a lot of potential error messages) between a try/catch, for which a very small number of people were experiencing a timezone issue with their Google Sheet file.
The aim was to use a JavaScript 'match' to find the keyword timezone and display a set of instructions for the user to resolve the issue themselves instead of just a generic error message. The below Apps Script code is a simplified version of all of that aimed at just getting a file and using a typo in the code to trigger an error.
Filter an error message in a try/catch |