Browse Source

build-logger: handle socket errors better

master
Guillermo Rauch 9 years ago
parent
commit
14be7dd818
  1. 9
      lib/build-logger.js

9
lib/build-logger.js

@ -8,6 +8,7 @@ export default class Logger extends EventEmitter {
constructor (host, { debug = false, quiet = false } = {}) { constructor (host, { debug = false, quiet = false } = {}) {
super(); super();
this.host = host; this.host = host;
this.debug = debug;
this.quiet = quiet; this.quiet = quiet;
// readyState // readyState
@ -84,10 +85,10 @@ export default class Logger extends EventEmitter {
this.emit('close'); this.emit('close');
} }
onSocketError () { onSocketError (err) {
this.removeAllListeners(); if (this.debug) {
console.error('> Connection error'); console.log('> [debug] Socket error', err.stack);
this.emit('error'); }
} }
} }

Loading…
Cancel
Save