diff --git a/lib/stream.js b/lib/stream.js index f0e1b6e..baf4a61 100644 --- a/lib/stream.js +++ b/lib/stream.js @@ -170,7 +170,7 @@ class SyncStream extends Pipeable { this.#remoteWant.set(id, remoteWantRange) const goal = this.#goals.get(id) const haveRange = this.#localHave.get(id) - if (!haveRange) throw new Error('local have-range not set') + if (!haveRange) throw new Error(`Local have-range not set for ${id}`) const localWant = this.#algo.wantRange(haveRange, remoteHaveRange, goal) this.#localWant.set(id, localWant) const localBloom0 = this.#algo.bloomFor(id, 0, localWant) @@ -200,7 +200,7 @@ class SyncStream extends Pipeable { ) this.#updateSendableMsgs(id, msgIDsForThem) const localWantRange = this.#localWant.get(id) - if (!localWantRange) throw new Error('local want-range not set') + if (!localWantRange) throw new Error(`Local want-range not set for ${id}`) const localBloom = this.#algo.bloomFor(id, 0, localWantRange) this.sink.write({ id, @@ -222,7 +222,7 @@ class SyncStream extends Pipeable { // prettier-ignore this.#debug('%s Stream IN%s: got bloom round %s plus msgIDs in %s: %o', this.#myId, phase-1, round-1, id, msgIDsForMe) const remoteWantRange = this.#remoteWant.get(id) - if (!remoteWantRange) throw new Error('remote want-range not set') + if (!remoteWantRange) throw new Error(`Remote want-range not set for ${id}`) this.#updateReceivableMsgs(id, msgIDsForMe) const msgIDsForThem = this.#algo.getMsgsMissing( id, @@ -233,7 +233,7 @@ class SyncStream extends Pipeable { this.#updateSendableMsgs(id, msgIDsForThem) const extras = this.#receivableMsgs.get(id) const localWantRange = this.#localWant.get(id) - if (!localWantRange) throw new Error('local want-range not set') + if (!localWantRange) throw new Error(`Local want-range not set for ${id}`) const localBloom = this.#algo.bloomFor(id, round, localWantRange, extras) this.sink.write({ id, @@ -255,7 +255,7 @@ class SyncStream extends Pipeable { // prettier-ignore this.#debug('%s Stream IN%s: got bloom round %s plus msgIDs in %s: %o', this.#myId, phase-1, round, id, msgIDsForMe) const remoteWantRange = this.#remoteWant.get(id) - if (!remoteWantRange) throw new Error('remote want-range not set') + if (!remoteWantRange) throw new Error(`Remote want-range not set for ${id}`) this.#updateReceivableMsgs(id, msgIDsForMe) const msgIDsForThem = this.#algo.getMsgsMissing( id, @@ -266,7 +266,7 @@ class SyncStream extends Pipeable { this.#updateSendableMsgs(id, msgIDsForThem) const extras = this.#receivableMsgs.get(id) const localWantRange = this.#localWant.get(id) - if (!localWantRange) throw new Error('local want-range not set') + if (!localWantRange) throw new Error(`Local want-range not set for ${id}`) const localBloom = this.#algo.bloomFor(id, round, localWantRange, extras) this.sink.write({ id, @@ -287,7 +287,7 @@ class SyncStream extends Pipeable { // prettier-ignore this.#debug('%s Stream IN7: got bloom round %s plus msgIDs in %s: %o', this.#myId, round, id, msgIDsForMe) const remoteWantRange = this.#remoteWant.get(id) - if (!remoteWantRange) throw new Error('remote want-range not set') + if (!remoteWantRange) throw new Error(`Remote want-range not set for ${id}`) this.#updateReceivableMsgs(id, msgIDsForMe) const msgIDsForThem = this.#algo.getMsgsMissing( id, @@ -302,7 +302,7 @@ class SyncStream extends Pipeable { const msgs = accountMsgs.concat(tangleMsgs) const extras = this.#receivableMsgs.get(id) const localWantRange = this.#localWant.get(id) - if (!localWantRange) throw new Error('local want-range not set') + if (!localWantRange) throw new Error(`Local want-range not set for ${id}`) const localBloom = this.#algo.bloomFor(id, round, localWantRange, extras) this.sink.write({ id, @@ -323,7 +323,7 @@ class SyncStream extends Pipeable { // prettier-ignore this.#debug('%s Stream IN8: got bloom round %s plus %s msgs in %s', this.#myId, round, msgsForMe.length, id) const remoteWantRange = this.#remoteWant.get(id) - if (!remoteWantRange) throw new Error('remote want-range not set') + if (!remoteWantRange) throw new Error(`Remote want-range not set for ${id}`) const msgIDsForThem = this.#algo.getMsgsMissing( id, round, @@ -342,7 +342,7 @@ class SyncStream extends Pipeable { const goal = this.#goals.get(id) if (!goal) throw new Error(`No goal found for "${id}"`) const localWantRange = this.#localWant.get(id) - if (!localWantRange) throw new Error('local want-range not set') + if (!localWantRange) throw new Error(`Local want-range not set for ${id}`) this.#requested.delete(id) this.#localHave.delete(id) this.#localWant.delete(id) @@ -380,7 +380,7 @@ class SyncStream extends Pipeable { if (msgsForMe.length === 0) return const goal = this.#goals.get(id) if (!goal) throw new Error(`No goal found for "${id}"`) - if (!localWantRange) throw new Error('local want-range not set') + if (!localWantRange) throw new Error(`Local want-range not set for "${id}"`) try { this.#algo.commit(id, msgsForMe, goal, localWantRange) } catch (err) {