From 8ecf5180222d1698b09eec63b31b513915c6f8d1 Mon Sep 17 00:00:00 2001 From: apanizo Date: Wed, 29 Aug 2018 09:20:20 +0200 Subject: [PATCH] Executing DailyLimit operation in a controlled try/catch way --- src/logic/safe/safeBlockchainOperations.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/logic/safe/safeBlockchainOperations.js b/src/logic/safe/safeBlockchainOperations.js index efa2d531..d71be6c7 100644 --- a/src/logic/safe/safeBlockchainOperations.js +++ b/src/logic/safe/safeBlockchainOperations.js @@ -118,8 +118,14 @@ export const executeDailyLimit = async ( const gas = await calculateGasOf(dailyLimitData, sender, dailyLimitModule.address) const gasPrice = await calculateGasPrice() - const txReceipt = await dailyLimitModule.executeDailyLimit(0, to, valueInWei, { from: sender, gas, gasPrice }) - checkReceiptStatus(txReceipt.tx) + try { + const txReceipt = await dailyLimitModule.executeDailyLimit(0, to, valueInWei, { from: sender, gas, gasPrice }) + await checkReceiptStatus(txReceipt.tx) + + return Promise.resolve(txReceipt.tx) + } catch (err) { + return Promise.reject(new Error(err)) + } /* // Temporarily disabled for daily limit operations @@ -128,5 +134,4 @@ export const executeDailyLimit = async ( await submitOperation(safeAddress, to, Number(valueInWei), data, operation, nonce, txReceipt.tx, sender, 'execution') */ - return txReceipt.tx }