Skip to content

Commit 1c68931

Browse files
authored
Merge pull request #122 from 2skydev/dev
v0.0.26
2 parents 422a5b1 + 126d32b commit 1c68931

File tree

1 file changed

+33
-7
lines changed

1 file changed

+33
-7
lines changed

src/main/index.ts

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import 'reflect-metadata'
22

3+
import { app, dialog } from 'electron'
4+
import log from 'electron-log'
5+
36
import { NestFactory } from '@nestjs/core'
47
import * as Sentry from '@sentry/electron/main'
58

@@ -15,15 +18,38 @@ if (process.env.NODE_ENV !== 'development') {
1518
}
1619

1720
const bootstrap = async () => {
18-
const app = await NestFactory.createApplicationContext(AppModule)
21+
try {
22+
const app = await NestFactory.createApplicationContext(AppModule)
23+
24+
const leagueService = app.get(LeagueService)
25+
const updateService = app.get(UpdateService)
26+
const electronService = app.get(ElectronService)
27+
28+
await leagueService.clientInitialize()
29+
await updateService.autoUpdate()
30+
await electronService.start()
31+
} catch (error: any) {
32+
log.error('Failed to bootstrap application')
33+
log.error(error?.message, error)
34+
35+
await app.whenReady()
1936

20-
const leagueService = app.get(LeagueService)
21-
const updateService = app.get(UpdateService)
22-
const electronService = app.get(ElectronService)
37+
if (error?.message === 'unable to verify the first certificate') {
38+
dialog.showErrorBox(
39+
'앱 실행 오류',
40+
`인증서 오류로 인해 앱을 실행할 수 없습니다.\n네트워크를 변경하는 앱이 실행 중이라면 이 앱은 제외해주세요. (예시: 유니콘 Pro)\n자세한 로그는 ${
41+
log.transports.file.getFile().path
42+
}`,
43+
)
44+
} else {
45+
dialog.showErrorBox(
46+
'앱 실행 오류',
47+
`${error?.message}\n자세한 로그는 ${log.transports.file.getFile().path}`,
48+
)
49+
}
2350

24-
await leagueService.clientInitialize()
25-
await updateService.autoUpdate()
26-
await electronService.start()
51+
process.exit(1)
52+
}
2753
}
2854

2955
bootstrap()

0 commit comments

Comments
 (0)