Don't swallow client errors

Reviewed By: @​swarr

Differential Revision: D2472285
This commit is contained in:
Martin Bigio 2015-09-23 12:38:55 -07:00 committed by facebook-github-bot-3
parent 1ce0853c39
commit 16a9a5beda
1 changed files with 4 additions and 1 deletions

View File

@ -29,7 +29,10 @@ class SocketClient {
this._sock = net.connect(sockPath);
this._ready = new Promise((resolve, reject) => {
this._sock.on('connect', () => resolve(this));
this._sock.on('connect', () => {
this._sock.removeAllListeners('error');
resolve(this);
});
this._sock.on('error', (e) => {
e.message = `Error connecting to server on ${sockPath} ` +
`with error: ${e.message}`;