mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add better error message if the proxy test fails (#3913)
* Add better error message if the proxy test fails Signed-off-by: Sebastian Malton <sebastian@malton.name> * resolve pr comment Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
731f119b1b
commit
5bdebfda43
@ -27,7 +27,7 @@ import * as Mobx from "mobx";
|
|||||||
import * as LensExtensionsCommonApi from "../extensions/common-api";
|
import * as LensExtensionsCommonApi from "../extensions/common-api";
|
||||||
import * as LensExtensionsMainApi from "../extensions/main-api";
|
import * as LensExtensionsMainApi from "../extensions/main-api";
|
||||||
import { app, autoUpdater, dialog, powerMonitor } from "electron";
|
import { app, autoUpdater, dialog, powerMonitor } from "electron";
|
||||||
import { appName, isIntegrationTesting, isMac, productName } from "../common/vars";
|
import { appName, isIntegrationTesting, isMac, isWindows, productName } from "../common/vars";
|
||||||
import { LensProxy } from "./lens-proxy";
|
import { LensProxy } from "./lens-proxy";
|
||||||
import { WindowManager } from "./window-manager";
|
import { WindowManager } from "./window-manager";
|
||||||
import { ClusterManager } from "./cluster-manager";
|
import { ClusterManager } from "./cluster-manager";
|
||||||
@ -133,9 +133,7 @@ app.on("ready", async () => {
|
|||||||
|
|
||||||
bindBroadcastHandlers();
|
bindBroadcastHandlers();
|
||||||
|
|
||||||
powerMonitor.on("shutdown", () => {
|
powerMonitor.on("shutdown", () => app.exit());
|
||||||
app.exit();
|
|
||||||
});
|
|
||||||
|
|
||||||
registerFileProtocol("static", __static);
|
registerFileProtocol("static", __static);
|
||||||
|
|
||||||
@ -183,7 +181,8 @@ app.on("ready", async () => {
|
|||||||
await lensProxy.listen();
|
await lensProxy.listen();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
dialog.showErrorBox("Lens Error", `Could not start proxy: ${error?.message || "unknown error"}`);
|
dialog.showErrorBox("Lens Error", `Could not start proxy: ${error?.message || "unknown error"}`);
|
||||||
app.exit();
|
|
||||||
|
return app.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// test proxy connection
|
// test proxy connection
|
||||||
@ -193,13 +192,27 @@ app.on("ready", async () => {
|
|||||||
|
|
||||||
if (getAppVersion() !== versionFromProxy) {
|
if (getAppVersion() !== versionFromProxy) {
|
||||||
logger.error("Proxy server responded with invalid response");
|
logger.error("Proxy server responded with invalid response");
|
||||||
app.exit();
|
|
||||||
} else {
|
return app.exit();
|
||||||
logger.info("⚡ LensProxy connection OK");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info("⚡ LensProxy connection OK");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`🛑 LensProxy: failed connection test: ${error}`);
|
logger.error(`🛑 LensProxy: failed connection test: ${error}`);
|
||||||
app.exit();
|
|
||||||
|
const hostsPath = isWindows
|
||||||
|
? "C:\\windows\\system32\\drivers\\etc\\hosts"
|
||||||
|
: "/etc/hosts";
|
||||||
|
const message = [
|
||||||
|
`Failed connection test: ${error}`,
|
||||||
|
"Check to make sure that no other versions of Lens are running",
|
||||||
|
`Check ${hostsPath} to make sure that it is clean and that the localhost loopback is at the top and set to 127.0.0.1`,
|
||||||
|
"If you have HTTP_PROXY or http_proxy set in your environment, make sure that the localhost and the ipv4 loopback address 127.0.0.1 are added to the NO_PROXY environment variable.",
|
||||||
|
];
|
||||||
|
|
||||||
|
dialog.showErrorBox("Lens Proxy Error", message.join("\n\n"));
|
||||||
|
|
||||||
|
return app.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
initializers.initRegistries();
|
initializers.initRegistries();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user