Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Feat/handle throws #75

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"libp2p-tcp": "^0.11.5",
"libp2p-websockets": "~0.10.4",
"pre-commit": "^1.2.2",
"pull-abortable": "^4.1.1",
"pull-pair": "^1.1.0"
},
"dependencies": {
Expand Down
7 changes: 6 additions & 1 deletion src/muxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ class MultiplexMuxer extends EventEmitter {
// method added to enable pure stream muxer feeling
newStream (callback) {
callback = callback || noop
let stream = this.multiplex.createStream()
let stream
try {
stream = this.multiplex.createStream()
} catch (err) {
return setImmediate(callback(err))
}

const conn = new Connection(
catchError(toPull.duplex(stream)),
Expand Down