mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-04-25 10:32:14 +00:00
fix: wrap newStream errors to improve debuggability
This commit is contained in:
parent
aadeb73c94
commit
6bfd2c7c46
@ -253,7 +253,7 @@ class Upgrader {
|
||||
return { stream: { ...muxedStream, ...stream }, protocol }
|
||||
} catch (err) {
|
||||
log.error('could not create new stream', err)
|
||||
throw errCode(err, codes.ERR_UNSUPPORTED_PROTOCOL)
|
||||
throw errCode(new Error('Could not create a new stream'), codes.ERR_UNSUPPORTED_PROTOCOL, { cause: err })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,6 +339,7 @@ describe('Upgrader', () => {
|
||||
results.forEach(result => {
|
||||
expect(result.isRejected).to.equal(true)
|
||||
expect(result.reason.code).to.equal(codes.ERR_UNSUPPORTED_PROTOCOL)
|
||||
expect(result.reason.cause).to.exist()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user