mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove calls to show error popup on stopping
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
c6a9d56bac
commit
e49b0f61ce
@ -4,6 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import loggerInjectable from "../../../../common/logger.injectable";
|
import loggerInjectable from "../../../../common/logger.injectable";
|
||||||
|
import { hasTypedProperty, isObject, isString } from "../../../../common/utils";
|
||||||
import { getStartableStoppable } from "../../../../common/utils/get-startable-stoppable";
|
import { getStartableStoppable } from "../../../../common/utils/get-startable-stoppable";
|
||||||
import isWindowsInjectable from "../../../../common/vars/is-windows.injectable";
|
import isWindowsInjectable from "../../../../common/vars/is-windows.injectable";
|
||||||
import exitAppInjectable from "../../../electron-app/features/exit-app.injectable";
|
import exitAppInjectable from "../../../electron-app/features/exit-app.injectable";
|
||||||
@ -12,6 +13,14 @@ import lensProxyInjectable from "../../../lens-proxy/lens-proxy.injectable";
|
|||||||
import buildVersionInjectable from "../../../vars/build-version/build-version.injectable";
|
import buildVersionInjectable from "../../../vars/build-version/build-version.injectable";
|
||||||
import requestAppVersionViaProxyInjectable from "./request-app-version.injectable";
|
import requestAppVersionViaProxyInjectable from "./request-app-version.injectable";
|
||||||
|
|
||||||
|
const getErrorMessage = (error: unknown, fallback: string): string => {
|
||||||
|
if (isObject(error) && hasTypedProperty(error, "message", isString)) {
|
||||||
|
return error.message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fallback;
|
||||||
|
};
|
||||||
|
|
||||||
const setupLensProxyStartableStoppableInjectable = getInjectable({
|
const setupLensProxyStartableStoppableInjectable = getInjectable({
|
||||||
id: "setup-lens-proxy-startable-stoppable",
|
id: "setup-lens-proxy-startable-stoppable",
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
@ -30,10 +39,13 @@ const setupLensProxyStartableStoppableInjectable = getInjectable({
|
|||||||
try {
|
try {
|
||||||
logger.info("🔌 Starting LensProxy");
|
logger.info("🔌 Starting LensProxy");
|
||||||
await lensProxy.listen({ signal: controller.signal }); // lensProxy.port available
|
await lensProxy.listen({ signal: controller.signal }); // lensProxy.port available
|
||||||
} catch (error: any) {
|
} catch (error) {
|
||||||
showErrorPopup("Lens Error", `Could not start proxy: ${error?.message || "unknown error"}`);
|
if (!controller.signal.aborted) {
|
||||||
|
showErrorPopup("Lens Error", `Could not start proxy: ${getErrorMessage(error, "unknown error")}`);
|
||||||
|
exitApp();
|
||||||
|
}
|
||||||
|
|
||||||
return exitApp();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// test proxy connection
|
// test proxy connection
|
||||||
@ -49,6 +61,10 @@ const setupLensProxyStartableStoppableInjectable = getInjectable({
|
|||||||
|
|
||||||
logger.info("⚡ LensProxy connection OK");
|
logger.info("⚡ LensProxy connection OK");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
if (controller.signal.aborted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
logger.error(`🛑 LensProxy: failed connection test: ${error}`);
|
logger.error(`🛑 LensProxy: failed connection test: ${error}`);
|
||||||
|
|
||||||
const hostsPath = isWindows
|
const hostsPath = isWindows
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user