4

Is there a method to send the google apps script execution failure notifications to an email address other than the account the trigger is assigned to?

Switching over the ownership of the trigger is not possible in this case as I am trying to run quite a few triggers which would exceed the permitted total runtime per account.

s_ll
  • 71
  • 1
  • 1
  • 6

1 Answers1

2

I've had the same concern. My imperfect solution was to create this custom function:

function errorReport(body) {
     var to = "yourNewEmail";
     MailApp.sendEmail(to, "Custom script error report", body);
}

And call it from every try-catch statement:

 try {
     // problematic code
 } catch(err) {
    errorReport(err);
 }

A second option is to set up a Gmail filter in each account you're using to silently forward and delete any apps script failure emails to your desired account: How to Forward Gmail Email Using Filters

harshaw61
  • 63
  • 9