Skip to content

Commit 4a9e52e

Browse files
committed
Ignore EPIPE exception on Windows when reloading demo client
Whenever the demo is reloaded on Windows the demo server crashes. This just ignores the error as I tried logging and adding try/catch around all interactions with the websocket and couldn't narrow it down.
1 parent 795839c commit 4a9e52e

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

demo/server.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,12 @@ function startServer() {
185185
app.listen(port, host, 0);
186186
}
187187

188+
// HACK: There is an EPIPE error thrown when reloading a page. This only seems to happen on Windows
189+
// and it's unclear why it happens. Suppressing the error here since this is just the demo server.
190+
process.on('uncaughtException', (error) => {
191+
if (process.platform === 'win32' && error.message === 'read EPIPE') {
192+
return;
193+
}
194+
});
195+
188196
module.exports = startServer;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"deep-equal": "^2.0.5",
7878
"eslint": "^8.56.0",
7979
"eslint-plugin-jsdoc": "^46.9.1",
80-
"express": "^4.17.1",
80+
"express": "^4.19.2",
8181
"express-ws": "^5.0.2",
8282
"glob": "^7.2.0",
8383
"jsdom": "^18.0.1",

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1951,7 +1951,7 @@ express-ws@^5.0.2:
19511951
dependencies:
19521952
ws "^7.4.6"
19531953

1954-
express@^4.17.1:
1954+
express@^4.19.2:
19551955
version "4.19.2"
19561956
resolved "https://registry.yarnpkg.com/express/-/express-4.19.2.tgz#e25437827a3aa7f2a827bc8171bbbb664a356465"
19571957
integrity sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==

0 commit comments

Comments
 (0)