How to catch UrlFetchApp.fetch exception

前端 未结 4 722
孤街浪徒
孤街浪徒 2020-12-18 19:26

Is there any way to catch the exception from UrlFetchApp.fetch?

I thought I can use response.getResponseCode() to check the response code,

4条回答
  •  被撕碎了的回忆
    2020-12-18 19:58

    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.

提交回复
热议问题