mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-28 16:31:35 +00:00
feat: add explicit error for case peer id not included in multiaddr (#155)
This commit is contained in:
committed by
David Dias
parent
248d86d050
commit
bd8a35aaf9
@ -319,7 +319,12 @@ class Node extends EventEmitter {
|
||||
if (typeof peer === 'string') {
|
||||
peer = multiaddr(peer)
|
||||
}
|
||||
|
||||
const peerIdB58Str = peer.getPeerId()
|
||||
if (!peerIdB58Str) {
|
||||
throw new Error(`peer multiaddr instance or string must include peerId`)
|
||||
}
|
||||
|
||||
try {
|
||||
p = this.peerBook.get(peerIdB58Str)
|
||||
} catch (err) {
|
||||
|
Reference in New Issue
Block a user