diff --git a/lib/start-proxy-action.js b/lib/start-proxy-action.js index 8ee158f22..35885a94f 100644 --- a/lib/start-proxy-action.js +++ b/lib/start-proxy-action.js @@ -121713,17 +121713,11 @@ async function getProxyBinaryPath(logger) { // src/start-proxy/reachability.ts var https = __toESM(require("https")); var import_https_proxy_agent = __toESM(require_dist2()); -var ReachabilityError = class _ReachabilityError extends Error { - constructor(registry, statusCode) { - const statusStr = _ReachabilityError.getStatusStr(statusCode); - super(`Connection test to ${registry.url} failed.${statusStr}`); - this.registry = registry; +var ReachabilityError = class extends Error { + constructor(statusCode) { + super(); this.statusCode = statusCode; } - static getStatusStr(statusCode) { - if (statusCode === void 0) return ""; - return ` (${statusCode})`; - } }; var NetworkReachabilityBackend = class { constructor(logger, proxy) { @@ -121748,13 +121742,12 @@ var NetworkReachabilityBackend = class { if (res.statusCode !== void 0 && res.statusCode < 400) { resolve2(res.statusCode); } else { - reject(new ReachabilityError(registry, res.statusCode)); + reject(new ReachabilityError(res.statusCode)); } } ); req.on("error", (e) => { - this.logger.error(e); - reject(new ReachabilityError(registry)); + reject(e); }); req.end(); }); diff --git a/src/start-proxy/reachability.test.ts b/src/start-proxy/reachability.test.ts index a32178188..d3417462c 100644 --- a/src/start-proxy/reachability.test.ts +++ b/src/start-proxy/reachability.test.ts @@ -60,7 +60,7 @@ test("checkConnections - excludes failed status codes", async (t) => { sinon .stub(backend, "checkConnection") .onSecondCall() - .throws(new ReachabilityError(nugetFeed, 400)); + .throws(new ReachabilityError(400)); const messages = await withRecordingLoggerAsync(async (logger) => { const reachable = await checkConnections(logger, proxyInfo, backend); t.is(reachable.size, 1); diff --git a/src/start-proxy/reachability.ts b/src/start-proxy/reachability.ts index 68774f9c6..fd14e92e6 100644 --- a/src/start-proxy/reachability.ts +++ b/src/start-proxy/reachability.ts @@ -5,20 +5,11 @@ import { HttpsProxyAgent } from "https-proxy-agent"; import { Logger } from "../logging"; import { getErrorMessage } from "../util"; -import { getAddressString, ProxyInfo, Registry, ValidRegistry } from "./types"; +import { getAddressString, ProxyInfo, ValidRegistry } from "./types"; export class ReachabilityError extends Error { - constructor( - public readonly registry: Registry, - public readonly statusCode?: number | undefined, - ) { - const statusStr = ReachabilityError.getStatusStr(statusCode); - super(`Connection test to ${registry.url} failed.${statusStr}`); - } - - private static getStatusStr(statusCode: number | undefined) { - if (statusCode === undefined) return ""; - return ` (${statusCode})`; + constructor(public readonly statusCode?: number | undefined) { + super(); } } @@ -63,13 +54,12 @@ class NetworkReachabilityBackend implements ReachabilityBackend { if (res.statusCode !== undefined && res.statusCode < 400) { resolve(res.statusCode); } else { - reject(new ReachabilityError(registry, res.statusCode)); + reject(new ReachabilityError(res.statusCode)); } }, ); req.on("error", (e) => { - this.logger.error(e); - reject(new ReachabilityError(registry)); + reject(e); }); req.end(); });