From 14be7dd8181cc9b1a4d43be695b144599034a9fb Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Sun, 14 Aug 2016 23:11:12 -0700 Subject: [PATCH] build-logger: handle socket errors better --- lib/build-logger.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/build-logger.js b/lib/build-logger.js index 286e804..f0d6700 100644 --- a/lib/build-logger.js +++ b/lib/build-logger.js @@ -8,6 +8,7 @@ export default class Logger extends EventEmitter { constructor (host, { debug = false, quiet = false } = {}) { super(); this.host = host; + this.debug = debug; this.quiet = quiet; // readyState @@ -84,10 +85,10 @@ export default class Logger extends EventEmitter { this.emit('close'); } - onSocketError () { - this.removeAllListeners(); - console.error('> Connection error'); - this.emit('error'); + onSocketError (err) { + if (this.debug) { + console.log('> [debug] Socket error', err.stack); + } } }