From a7afb4e14eee62e8bdd8a9347bc8ea5fa55f2488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Uhl=C3=AD=C5=99?= Date: Tue, 28 Jun 2022 11:19:58 +0200 Subject: [PATCH] feat: top level error catch (#156) --- src/index.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index a47c8a4..1693b9b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,7 @@ +import { readFileSync, writeFileSync } from 'fs-extra' +import * as Sentry from '@sentry/electron' +import { dialog } from 'electron' + import { openDashboardInBrowser, openInstallerInBrowser } from './browser' import { runDownloader } from './downloader' import { runElectronTray } from './electron' @@ -5,12 +9,9 @@ import { runKeepAliveLoop, runLauncher } from './launcher' import { findFreePort } from './port' import { runServer } from './server' import { getStatus } from './status' -import * as Sentry from '@sentry/electron' - import SENTRY from './.sentry.json' import PACKAGE_JSON from '../package.json' import { logger } from './logger' -import { readFileSync, writeFileSync } from 'fs-extra' import { getPath } from './path' import { ensureApiKey } from './api-key' @@ -87,4 +88,6 @@ async function main() { runKeepAliveLoop() } -main() +main().catch(e => { + dialog.showErrorBox('There was an error in Swarm Desktop', e.message) +})