O'Reilly logo
  • Joseph Vaughan thinks this is interesting:

html.setContent(e.name + ' on line: ' + e.lineNumber + ' -> ' + e.message);

From

Cover of Google Apps Script, 2nd Edition

Note

When I run this code, I get an error “cannot call method setContent of undefined”. This is because the var html is only set in the try stanza.

Instead the code in the catch stanza needs to be something like:

> var html = HtmlService.createHtmlOutput(‘Error‘);
> html.append(e.name + ‘ on line: ‘ + e.lineNumber + ‘ -> ‘ +
> e.message);