Skip to content

Commit 8d382f4

Browse files
authored
🐛 Catch error states of chokidar (#2543)
Fixes #2500
1 parent 519ef0e commit 8d382f4

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.changeset/chubby-mugs-dream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'myst-cli': patch
3+
---
4+
5+
Catch error states of chokidar

packages/myst-cli/src/build/site/watch.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ function watchConfigAndPublic(
2525
ignoreInitial: true,
2626
awaitWriteFinish: { stabilityThreshold: 100, pollInterval: 50 },
2727
})
28-
.on('all', watchProcessor(session, null, serverReload, opts));
28+
.on('all', watchProcessor(session, null, serverReload, opts))
29+
.on('error', (error) => {
30+
session.log.error(`Error watching config and public: ${error}`);
31+
});
2932
}
3033

3134
function triggerProjectReload(
@@ -201,7 +204,10 @@ export function watchContent(
201204
awaitWriteFinish: { stabilityThreshold: 100, pollInterval: 50 },
202205
cwd: proj.path,
203206
})
204-
.on('all', watchProcessor(session, proj, serverReload, opts));
207+
.on('all', watchProcessor(session, proj, serverReload, opts))
208+
.on('error', (error) => {
209+
session.log.error(`Error watching project ${proj.path}: ${error}`);
210+
});
205211
});
206212
// Watch the myst.yml
207213
watchConfigAndPublic(session, serverReload, opts);

0 commit comments

Comments
 (0)