@applitools/execution-grid-client
Advanced tools
Comparing version 1.1.13 to 1.1.14
@@ -44,7 +44,7 @@ "use strict"; | ||
const response = await (0, node_fetch_1.default)(request); | ||
const body = await response.json(); | ||
const body = await response.json().catch(() => null); | ||
if (response.status === 201) | ||
return body; | ||
if (!RETRY_ERROR_CODES.includes(body === null || body === void 0 ? void 0 : body.message)) { | ||
logger.error(`Failed to create tunnel with code ${(_a = body === null || body === void 0 ? void 0 : body.message) !== null && _a !== void 0 ? _a : 'UNKNOWN_ERROR'}`); | ||
if (!RETRY_ERROR_CODES.includes(body === null || body === void 0 ? void 0 : body.message) && response.status >= 400 && response.status < 500) { | ||
logger.error(`Failed to create tunnel with status ${response.status} and code ${(_a = body === null || body === void 0 ? void 0 : body.message) !== null && _a !== void 0 ? _a : 'UNKNOWN_ERROR'}`); | ||
throw new Error(`Failed to create tunnel with code ${(_b = body === null || body === void 0 ? void 0 : body.message) !== null && _b !== void 0 ? _b : 'UNKNOWN_ERROR'}`); | ||
@@ -63,7 +63,14 @@ } | ||
}); | ||
const response = await (0, node_fetch_1.default)(request); | ||
if (response.status !== 200) { | ||
const body = await response.json(); | ||
logger.error(`Failed to delete tunnel with code ${(_a = body === null || body === void 0 ? void 0 : body.message) !== null && _a !== void 0 ? _a : 'UNKNOWN_ERROR'}`); | ||
throw new Error(`Failed to delete tunnel with code ${(_b = body === null || body === void 0 ? void 0 : body.message) !== null && _b !== void 0 ? _b : 'UNKNOWN_ERROR'}`); | ||
let attempt = 0; | ||
while (true) { | ||
const response = await (0, node_fetch_1.default)(request); | ||
if (response.status === 200) | ||
return; | ||
if (response.status >= 400 && response.status < 500) { | ||
const body = await response.json().catch(() => null); | ||
logger.error(`Failed to delete tunnel with status ${response.status} and code ${(_a = body === null || body === void 0 ? void 0 : body.message) !== null && _a !== void 0 ? _a : 'UNKNOWN_ERROR'}`); | ||
throw new Error(`Failed to delete tunnel with code ${(_b = body === null || body === void 0 ? void 0 : body.message) !== null && _b !== void 0 ? _b : 'UNKNOWN_ERROR'}`); | ||
} | ||
await utils.general.sleep(RETRY_BACKOFF[Math.min(attempt, RETRY_BACKOFF.length - 1)]); | ||
attempt += 1; | ||
} | ||
@@ -70,0 +77,0 @@ } |
{ | ||
"name": "@applitools/execution-grid-client", | ||
"version": "1.1.13", | ||
"version": "1.1.14", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49654
730