Skip to content
This repository was archived by the owner on Jun 5, 2019. It is now read-only.

Commit 40f2a0a

Browse files
committed
Show an error with semi-helpful text when we fail to load a page
1 parent 1da0b4c commit 40f2a0a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/main.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { app, ipcMain } from 'electron'
1+
import { app, dialog, ipcMain } from 'electron'
22
import { createMainWindow } from './main-window/main-window'
33
import { loadURL } from './main-window/load-url'
44
import * as log from 'electron-log'
@@ -23,6 +23,13 @@ app.on('ready', () => {
2323
createMenu(window)
2424

2525
if (isDev) {
26+
window.webContents.on('did-fail-load', () => {
27+
dialog.showErrorBox(
28+
'Error opening storybook',
29+
'Storybook failed to open. Please ensure the storybook server is running by executing "npm run storybook"',
30+
)
31+
})
32+
2633
ipcMain.on('storybook-toggle', () => {
2734
log.info('toggle')
2835
showStorybook = !showStorybook

0 commit comments

Comments
 (0)