如何捕获来自 UrlFetchApp.fetchAll 的错误?
How to catch error from UrlFetchApp.fetchAll?
UrlFetchApp.fetchAll
speeds up the execution time. But with many requests, often occurs errors (429, 500, 503). In most cases, a second request will solve it. How can I catch them? According benchmark、HTTPResponse[]
与请求数组的顺序不同。因此我无法发送新请求 (UrlFetchApp.fetch
),不知道 url
和 params
.
let requests = [
{ url: '', muteHttpExceptions: true },
{ url: '', muteHttpExceptions: true }
];
let responses = UrlFetchApp.fetchAll(requests);
According benchmark, HTTPResponse[] has a different order than request array.
我错了。总结部分给出了下一条规则:
After it worked by the asynchronous processing, the returned values is reordered by the order of requests.
在我的实践中,确实如此。
谢谢Tanaike
UrlFetchApp.fetchAll
speeds up the execution time. But with many requests, often occurs errors (429, 500, 503). In most cases, a second request will solve it. How can I catch them? According benchmark、HTTPResponse[]
与请求数组的顺序不同。因此我无法发送新请求 (UrlFetchApp.fetch
),不知道 url
和 params
.
let requests = [
{ url: '', muteHttpExceptions: true },
{ url: '', muteHttpExceptions: true }
];
let responses = UrlFetchApp.fetchAll(requests);
According benchmark, HTTPResponse[] has a different order than request array.
我错了。总结部分给出了下一条规则:
After it worked by the asynchronous processing, the returned values is reordered by the order of requests.
在我的实践中,确实如此。
谢谢Tanaike