Merge pull request #12 from diasdavid/fix/error-handling

switch from throw to send err to callback
This commit is contained in:
David Dias 2016-04-25 02:16:46 +01:00
commit 2070a5b0a0

View File

@ -63,7 +63,7 @@ function TCP () {
this.close = (callback) => {
if (listeners.length === 0) {
throw new Error('there are no listeners')
callback(new Error('there are no listeners'))
}
var count = 0
listeners.forEach((listener) => {