mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Log as errors the places where getPortFrom can fail (#3425)
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
8683735630
commit
600d2c8607
@ -61,7 +61,8 @@ export class LensProxy extends Singleton {
|
|||||||
if (req.url.startsWith(`${apiPrefix}?`)) {
|
if (req.url.startsWith(`${apiPrefix}?`)) {
|
||||||
handleWsUpgrade(req, socket, head);
|
handleWsUpgrade(req, socket, head);
|
||||||
} else {
|
} else {
|
||||||
this.handleProxyUpgrade(proxy, req, socket, head);
|
this.handleProxyUpgrade(proxy, req, socket, head)
|
||||||
|
.catch(error => logger.error(`[LENS-PROXY]: failed to handle proxy upgrade: ${error}`));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -194,7 +195,8 @@ export class LensProxy extends Singleton {
|
|||||||
logger.debug(`Retrying proxy request to url: ${reqId}`);
|
logger.debug(`Retrying proxy request to url: ${reqId}`);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.retryCounters.set(reqId, retryCount + 1);
|
this.retryCounters.set(reqId, retryCount + 1);
|
||||||
this.handleRequest(proxy, req, res);
|
this.handleRequest(proxy, req, res)
|
||||||
|
.catch(error => logger.error(`[LENS-PROXY]: failed to handle request on proxy error: ${error}`));
|
||||||
}, timeoutMs);
|
}, timeoutMs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -134,11 +134,22 @@ export class PortForwardRoute {
|
|||||||
name: resourceName,
|
name: resourceName,
|
||||||
port,
|
port,
|
||||||
});
|
});
|
||||||
const started = await portForward.start();
|
|
||||||
|
|
||||||
if (!started) {
|
try {
|
||||||
|
const started = await portForward.start();
|
||||||
|
|
||||||
|
if (!started) {
|
||||||
|
logger.warn("[PORT-FORWARD-ROUTE]: failed to start a port-forward", { namespace, port, resourceType, resourceName });
|
||||||
|
|
||||||
|
return respondJson(response, {
|
||||||
|
message: "Failed to open port-forward"
|
||||||
|
}, 400);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
logger.warn(`[PORT-FORWARD-ROUTE]: failed to open a port-forward: ${error}`, { namespace, port, resourceType, resourceName });
|
||||||
|
|
||||||
return respondJson(response, {
|
return respondJson(response, {
|
||||||
message: "Failed to open port-forward"
|
message: error?.toString() || "Failed to open port-forward",
|
||||||
}, 400);
|
}, 400);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user