@piyushdoorwar/yamlet 1.0.1 → 1.0.3
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/yamlet.js +40 -7
- package/package.json +1 -1
package/dist/yamlet.js
CHANGED
|
@@ -1448,14 +1448,47 @@ ${opts.script}
|
|
|
1448
1448
|
var MAX_REDIRECTS = 10;
|
|
1449
1449
|
var insecure;
|
|
1450
1450
|
var insecureAgent = () => insecure ??= new Agent({ connect: { rejectUnauthorized: false } });
|
|
1451
|
+
var NETWORK_HINTS = {
|
|
1452
|
+
ENOTFOUND: "host name could not be resolved",
|
|
1453
|
+
EAI_AGAIN: "DNS lookup timed out",
|
|
1454
|
+
ECONNREFUSED: "connection refused",
|
|
1455
|
+
ECONNRESET: "connection reset by the server",
|
|
1456
|
+
ETIMEDOUT: "connection timed out",
|
|
1457
|
+
EHOSTUNREACH: "host unreachable",
|
|
1458
|
+
ENETUNREACH: "network unreachable",
|
|
1459
|
+
CERT_HAS_EXPIRED: "the server's certificate has expired",
|
|
1460
|
+
DEPTH_ZERO_SELF_SIGNED_CERT: "self-signed certificate (turn on Skip SSL verification in Settings)",
|
|
1461
|
+
SELF_SIGNED_CERT_IN_CHAIN: "self-signed certificate in chain (turn on Skip SSL verification in Settings)",
|
|
1462
|
+
UNABLE_TO_VERIFY_LEAF_SIGNATURE: "certificate could not be verified (turn on Skip SSL verification in Settings)",
|
|
1463
|
+
UND_ERR_CONNECT_TIMEOUT: "connection timed out",
|
|
1464
|
+
UND_ERR_HEADERS_TIMEOUT: "timed out waiting for response headers",
|
|
1465
|
+
UND_ERR_BODY_TIMEOUT: "timed out reading the response body",
|
|
1466
|
+
UND_ERR_SOCKET: "the connection closed unexpectedly"
|
|
1467
|
+
};
|
|
1451
1468
|
var errMessage2 = (e) => {
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
const
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1469
|
+
const parts = [];
|
|
1470
|
+
const add = (s) => {
|
|
1471
|
+
const t = s.trim();
|
|
1472
|
+
if (t && !parts.some((p) => p.includes(t))) parts.push(t);
|
|
1473
|
+
};
|
|
1474
|
+
const walk2 = (x, depth) => {
|
|
1475
|
+
if (!x || typeof x !== "object" || depth > 4) {
|
|
1476
|
+
if (typeof x === "string") add(x);
|
|
1477
|
+
return;
|
|
1478
|
+
}
|
|
1479
|
+
const err = x;
|
|
1480
|
+
const code = typeof err.code === "string" ? err.code : void 0;
|
|
1481
|
+
const msg = typeof err.message === "string" ? err.message : "";
|
|
1482
|
+
if (msg && msg !== "fetch failed") add(msg);
|
|
1483
|
+
const hasInner = Array.isArray(err.errors) && err.errors.length > 0;
|
|
1484
|
+
if (code && !msg && hasInner) {
|
|
1485
|
+
} else if (code && !msg.includes(code)) add(NETWORK_HINTS[code] ? `${code}: ${NETWORK_HINTS[code]}` : code);
|
|
1486
|
+
else if (code && NETWORK_HINTS[code]) add(`(${NETWORK_HINTS[code]})`);
|
|
1487
|
+
if (Array.isArray(err.errors)) for (const inner of err.errors.slice(0, 3)) walk2(inner, depth + 1);
|
|
1488
|
+
walk2(err.cause, depth + 1);
|
|
1489
|
+
};
|
|
1490
|
+
walk2(e, 0);
|
|
1491
|
+
return parts.join("; ") || "The request failed without an error message (network error).";
|
|
1459
1492
|
};
|
|
1460
1493
|
function headerValue(headers, name) {
|
|
1461
1494
|
const v = headers[name.toLowerCase()];
|