From 50b9ec534fd251adb77cc34b9b26b9fb0000c4dd Mon Sep 17 00:00:00 2001 From: Dimitri DO BAIRRO Date: Sat, 4 May 2019 12:36:51 +0200 Subject: [PATCH 1/2] fix(lib/transaction.ts) sometimes execResult is undefined --- lib/transaction.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/transaction.ts b/lib/transaction.ts index 11cdb04c..3624f822 100644 --- a/lib/transaction.ts +++ b/lib/transaction.ts @@ -34,6 +34,9 @@ export function addTransactionSupport (redis) { const promise = exec.call(pipeline) return asCallback(promise.then(function (result) { const execResult = result[result.length - 1] + if (typeof execResult === 'undefined') { + return + } if (execResult[0]) { execResult[0].previousErrors = [] for (let i = 0; i < result.length - 1; ++i) { From 733f239983c5c575b77e720dc6593deba53f871d Mon Sep 17 00:00:00 2001 From: Dimitri DO BAIRRO Date: Tue, 7 May 2019 09:18:41 +0200 Subject: [PATCH 2/2] fix(lib/transaction.ts) throw an error when .exec() has already been called --- lib/transaction.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/transaction.ts b/lib/transaction.ts index 3624f822..a881ff9c 100644 --- a/lib/transaction.ts +++ b/lib/transaction.ts @@ -35,7 +35,7 @@ export function addTransactionSupport (redis) { return asCallback(promise.then(function (result) { const execResult = result[result.length - 1] if (typeof execResult === 'undefined') { - return + throw new Error('Pipeline cannot be used to send any commands when the `exec()` has been called on it.'); } if (execResult[0]) { execResult[0].previousErrors = []