Skip to content
This repository has been archived by the owner on Aug 23, 2019. It is now read-only.

Commit

Permalink
handle errors when closing
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed May 8, 2016
1 parent 594b770 commit a6ba60a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,13 @@ function Swarm (peerInfo) {

async.each(
Object.keys(this.transports),
(key, cb) => this.transports[key].close(cb),
(key, cb) => {
// avoid unhandled error messages
this.transports[key].once('error', (err) => {
console.log('got error', err)
})
this.transports[key].close(cb)
},
callback
)
}
Expand Down

0 comments on commit a6ba60a

Please sign in to comment.