Skip to content

Commit

Permalink
chore(websocket): add error ignore list
Browse files Browse the repository at this point in the history
  • Loading branch information
huangyoukun authored and RobinzZH committed Jun 22, 2018
1 parent fe89cac commit 97d82b4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bin/proxy/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ function bind_listen(server) {
}

d.on('error', function(err) {
if (err && err.message && errorIgnore[err.message] === 'ignore') {
logger.warn(err && err.stack);
return;
}

if (err && err.stack && err.message) {
const key = err.message;
const content = `<p><strong>错误堆栈</strong></p><p><pre><code>${err.stack}</code></pre></p>`;
Expand Down Expand Up @@ -263,3 +268,11 @@ exports.start_listen = function() {
bind_listen(wss);
}
};

const errorIgnore = {
'socket hang up': 'ignore',
'Cannot read property \'asyncReset\' of null': 'ignore',
'Cannot read property \'resume\' of null': 'ignore',
'write ECONNRESET': 'ignore',
'This socket is closed': 'ignore'
};

0 comments on commit 97d82b4

Please sign in to comment.