Created
November 10, 2017 01:25
-
-
Save ksuzushima/adcf98f1755a77ddc7b6ff2bd107da85 to your computer and use it in GitHub Desktop.
Setting muteHttpExceptions to true in the HTTP request to suppress errors.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 備忘録 | |
* @link https://stackoverflow.com/questions/31891694/handle-404-errors-in-urlfetchapp-fetch | |
*/ | |
function fetchPage() { | |
var response = UrlFetchApp.fetch("http://ctrlq.org/404", {muteHttpExceptions: true}); | |
if (response.getResponseCode() == 404) { | |
Logger.log("Web page not found"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment