Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aef09d4

Browse files
committed
Emit rather than throw error
Close #80
1 parent 7703cc2 commit aef09d4

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

dist/binary.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ EventEmitter.prototype.addListener = function(type, listener, scope, once) {
629629
// Adding the second element, need to change to array.
630630
this._events[type] = [this._events[type], listener];
631631
}
632-
632+
return this;
633633
};
634634

635635
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
@@ -1283,7 +1283,8 @@ BinaryStream.prototype.write = function(data) {
12831283
var out = this._write(2, data, this.id);
12841284
return !this.paused && out;
12851285
} else {
1286-
throw new Error('Stream is not writable');
1286+
this.emit('error', new Error('Stream is not writable'));
1287+
return false;
12871288
}
12881289
};
12891290

0 commit comments

Comments
 (0)