Skip to content

Commit

Permalink
Merge pull request #20177 from storybookjs/fix-unhandled-exception
Browse files Browse the repository at this point in the history
Core: Catch and do nothing to avoid triggering unhandled exception problems
  • Loading branch information
shilman authored Dec 9, 2022
2 parents f56de0d + 535bd8d commit 50ea090
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion code/lib/core-server/src/dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ export async function storybookDevServer(options: Options) {
// this is a preview route, the builder has to be started before we can serve it
// this handler keeps request to that route pending until the builder is ready to serve it, preventing a 404
router.get('/iframe.html', (req, res, next) => {
previewStarted.then(() => next());
// We need to catch here or node will treat any errors thrown by `previewStarted` as
// unhandled and exit (even though they are very much handled below)
previewStarted.catch(() => {}).then(() => next());
});

Promise.all([initializedStoryIndexGenerator, listening, usingStatics]).then(async () => {
Expand Down

0 comments on commit 50ea090

Please sign in to comment.