From ac797132ae54221a3d6fac54d455346e70be8604 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Mon, 30 Jan 2017 13:32:23 -0600 Subject: [PATCH] add email notifications on error --- gs/type/RefreshData.gs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gs/type/RefreshData.gs b/gs/type/RefreshData.gs index 73b4d56ef..b504e1b93 100644 --- a/gs/type/RefreshData.gs +++ b/gs/type/RefreshData.gs @@ -436,9 +436,14 @@ function refreshHttpResponses(triggerNum) { var url = rangeData.getCell(i - 1, 1).getValue(); if (url) { try { - rangeStatus.setValue(UrlFetchApp.fetch(url).getResponseCode()); + var urlStatus = UrlFetchApp.fetch(url).getResponseCode(); + rangeStatus.setValue(urlStatus); + if (urlStatus != 200) { + MailApp.sendEmail("cb+flnotice" + "@collinmbarrett.com", urlStatus + ": " + url, urlStatus + ": " + url); + } } catch (err) { rangeStatus.setValue(err.message); + MailApp.sendEmail("cb+flnotice" + "@collinmbarrett.com", "Error: " + url, "Error: " + url + "
" + err.message); } } }