scrapely 1.2.17 → 1.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/charging.js
CHANGED
|
@@ -1185,6 +1185,8 @@ const NOT_SENT_CODES = new Set(['ECONNREFUSED', 'ENOTFOUND', 'EAI_AGAIN', 'EHOST
|
|
|
1185
1185
|
* resets after the request was sent are not proof (the write may have landed).
|
|
1186
1186
|
*/
|
|
1187
1187
|
function pushCertainlyFailed(err) {
|
|
1188
|
+
if ((0, api_storage_client_js_1.isConnectFailure)(err))
|
|
1189
|
+
return true;
|
|
1188
1190
|
for (let e = err, depth = 0; e && depth < 4; e = e.cause, depth++) {
|
|
1189
1191
|
const status = httpStatusOf(e);
|
|
1190
1192
|
if (status !== undefined)
|
|
@@ -206,7 +206,21 @@ function fetchErrorCode(err) {
|
|
|
206
206
|
/** fetch() failed before the request reached the server. */
|
|
207
207
|
function isConnectFailure(err) {
|
|
208
208
|
const code = fetchErrorCode(err);
|
|
209
|
-
|
|
209
|
+
if (code !== undefined && CONNECT_FAILURE_CODES.has(code))
|
|
210
|
+
return true;
|
|
211
|
+
// A TCP connect that timed out (`connect ETIMEDOUT`, or Node's happy-eyeballs
|
|
212
|
+
// AggregateError of connect attempts): nothing was sent. An ETIMEDOUT on an
|
|
213
|
+
// established socket (syscall "read") is not, so the syscall decides.
|
|
214
|
+
for (let e = err, depth = 0; e && depth < 4; e = e.cause, depth++) {
|
|
215
|
+
if (e.code === 'ETIMEDOUT' || e.code === 'ECONNREFUSED' || e.code === 'EHOSTUNREACH' || e.code === 'ENETUNREACH') {
|
|
216
|
+
if (e.syscall === 'connect')
|
|
217
|
+
return true;
|
|
218
|
+
const attempts = Array.isArray(e.errors) ? e.errors : [];
|
|
219
|
+
if (attempts.length > 0 && attempts.every((a) => a?.syscall === 'connect'))
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return false;
|
|
210
224
|
}
|
|
211
225
|
function describeFetchError(err) {
|
|
212
226
|
return fetchErrorCode(err) ?? err?.message ?? String(err);
|