Skip to content

Commit 381223d

Browse files
committed
chore(websocket): add error ignore list
1 parent 4f747c1 commit 381223d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

bin/proxy/websocket.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ function bind_listen(server) {
9292
}
9393

9494
d.on('error', function(err) {
95+
if (err && err.message && errorIgnore[err.message] === 'ignore') {
96+
logger.warn(err && err.stack);
97+
return;
98+
}
99+
95100
if (err && err.stack && err.message) {
96101
const key = err.message;
97102
const content = `<p><strong>错误堆栈</strong></p><p><pre><code>${err.stack}</code></pre></p>`;
@@ -263,3 +268,11 @@ exports.start_listen = function() {
263268
bind_listen(wss);
264269
}
265270
};
271+
272+
const errorIgnore = {
273+
'socket hang up': 'ignore',
274+
'Cannot read property \'asyncReset\' of null': 'ignore',
275+
'Cannot read property \'resume\' of null': 'ignore',
276+
'write ECONNRESET': 'ignore',
277+
'This socket is closed': 'ignore'
278+
};

0 commit comments

Comments
 (0)