mirror of
https://github.com/fluencelabs/js-libp2p-tcp
synced 2025-04-27 09:22:36 +00:00
Merge pull request #12 from diasdavid/fix/error-handling
switch from throw to send err to callback
This commit is contained in:
commit
2070a5b0a0
@ -63,7 +63,7 @@ function TCP () {
|
|||||||
|
|
||||||
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) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user