Is there any way to catch the exception from UrlFetchApp.fetch?
UrlFetchApp.fetch
I thought I can use response.getResponseCode() to check the response code,
response.getResponseCode()
Edit: This parameter is now documented here.
You can use the undocumented advanced option "muteHttpExceptions" to disable exceptions when a non-200 status code is returned, and then inspect the status code of the response. More information and an example is available on this issue.