Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google-apps-script what is the Exit command

In my Google Apps Script, when I catch an error, I email a log of the error then I want to exit the script immediately.

I cannot find a command to immediately terminate the script (the equivalent of PHP's exit(). Please can someone tell me how to do this?

Thanks in advance Alec

like image 450
user3069804 Avatar asked Jan 11 '23 17:01

user3069804


1 Answers

Return only works if you have a single function without depth. What you actually want is to throw an exception, and catch it (or not) in your top level function. As in throw new Error("ouch")

like image 128
Zig Mandel Avatar answered Jan 27 '23 23:01

Zig Mandel