move error to callback

This commit is contained in:
David Dias 2016-04-25 02:12:55 +01:00
parent 71c4d921d0
commit c03fad252d

View File

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