From c253a44f5923e24a0611fd385ac73d125c2f2494 Mon Sep 17 00:00:00 2001 From: David Dias Date: Mon, 25 Apr 2016 02:13:49 +0100 Subject: [PATCH] switch from throw to send err to callback --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index bb0f709..bd3a1a2 100644 --- a/src/index.js +++ b/src/index.js @@ -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) => {