Skip to content

Commit

Permalink
feat: add main window reject log
Browse files Browse the repository at this point in the history
  • Loading branch information
HSunboy committed Aug 13, 2024
1 parent 9c77c75 commit a1d9ce0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main/windows/mainWeb/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
* limitations under the License.
*/

import { BrowserWindow } from 'electron';
import { app, BrowserWindow, dialog } from 'electron';
import { PathnameStore } from '../../store';
import log from '../../utils/log';
import { downloadEvent, newWindowEvent } from './event';

export function openMainWebWindow(mainWindow: BrowserWindow) {
Expand All @@ -31,7 +32,14 @@ export function openMainWebWindow(mainWindow: BrowserWindow) {
if (process.env.ODC_DEBUG_MODE === 'open' || process.env.NODE_ENV === 'development') {
mainWindow!.webContents.openDevTools();
}
mainWindow!.loadURL(PathnameStore.getUrl());
mainWindow!.loadURL(PathnameStore.getUrl()).catch((e) => {
log.error('loadURL error', e);
dialog.showErrorBox(
`Open ODC Window Failed`,
`Please submit the log to the administrator(${app.getPath('userData')}/logs)`,
);
app.quit();
});
PathnameStore.reset();

return mainWindow;
Expand Down

0 comments on commit a1d9ce0

Please sign in to comment.