Question
There are various quota limits in Apps Script.
Is there a way to catch the error thrown when a quota limit is met and script/custom function terminated prematurely?
For example, if a script executed through the GUI is run for over 6 minutes, the user will be prompted with a message in red background that the "execution exceeded maximum time". Is there a way to catch this without the GUI?
Note:
I am not asking for optimization in Apps Script. There would be many duplicate questions and excellent answers in that regard. I understand there is no workaround to the hard quotas. I just want to catch whenever a quota limit is reached.
The context is that I am scraping data from a site in China that outputs an image which is in turn converted from numerical data in real time. The distance to server, the typical slow response of Chinese government sites, and the real time conversion are the (unavoidable) reasons for timeouts.