From c03fad252d37e86f4487e3e07a7698253e8b08fa Mon Sep 17 00:00:00 2001 From: David Dias Date: Mon, 25 Apr 2016 02:12:55 +0100 Subject: [PATCH] move error to callback --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 3b40187..fa189fd 100644 --- a/src/index.js +++ b/src/index.js @@ -61,7 +61,7 @@ function WebSockets () { 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) => {