From 8195c7f7282174f7822a46eab9cc015dc0c22497 Mon Sep 17 00:00:00 2001 From: Mathias Lundell Date: Mon, 23 Aug 2021 18:05:58 +0200 Subject: [PATCH] fix: error when unconfirmed message not found #152 --- src/ChannelWrapper.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ChannelWrapper.js b/src/ChannelWrapper.js index 62cee1b..e69b23d 100644 --- a/src/ChannelWrapper.js +++ b/src/ChannelWrapper.js @@ -496,9 +496,7 @@ export default class ChannelWrapper extends EventEmitter { function removeUnconfirmedMessage(arr, message) { const toRemove = arr.indexOf(message); - if (toRemove === -1) { - throw new Error(`Message is not in _unconfirmedMessages!`); + if (toRemove !== -1) { + arr.splice(toRemove, 1); } - const removed = arr.splice(toRemove, 1); - return removed[0]; }