Skip to content

Commit ff50152

Browse files
committed
Move error notifications to error dialogs
1 parent 1bc4def commit ff50152

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function reportError(error: Error | string) {
1313
import { spawn, exec, ChildProcess } from 'child_process';
1414
import * as os from 'os';
1515
import * as path from 'path';
16-
import { app, BrowserWindow, shell, Menu, Notification } from 'electron';
16+
import { app, BrowserWindow, shell, Menu, dialog } from 'electron';
1717

1818
import * as windowStateKeeper from 'electron-window-state';
1919

@@ -174,9 +174,9 @@ if (!amMainInstance) {
174174
});
175175
});
176176

177-
function showNotification(title: string, body: string) {
178-
const notification = new Notification({ title, body, icon: path.join(__dirname, 'src', 'icon.png') });
179-
notification.show();
177+
function showErrorAlert(title: string, body: string) {
178+
console.warn(`${title}: ${body}`);
179+
dialog.showErrorBox(title, body);
180180
}
181181

182182
async function startServer(retries = 2) {
@@ -235,8 +235,8 @@ if (!amMainInstance) {
235235
Sentry.addBreadcrumb({ category: 'server-exit', message: error.message, level: <any>'error', data: { serverRunTime } });
236236
reportError(error);
237237

238-
showNotification(
239-
'HTTP Toolkit crashed',
238+
showErrorAlert(
239+
'HTTP Toolkit hit an error',
240240
`${error.message}. Please file an issue at github.com/httptoolkit/feedback.`
241241
);
242242

0 commit comments

Comments
 (0)