From 6ec372add1f3cd5f1aa02a4dcc3462d0f5fab5cf Mon Sep 17 00:00:00 2001 From: Chalith Desaman Date: Thu, 30 Mar 2023 19:28:13 +0530 Subject: [PATCH] Changes client errors in propose and withdraw (#239) --- mb-xrpl/lib/governance-manager.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/mb-xrpl/lib/governance-manager.js b/mb-xrpl/lib/governance-manager.js index 6c06585..1eae51a 100644 --- a/mb-xrpl/lib/governance-manager.js +++ b/mb-xrpl/lib/governance-manager.js @@ -50,11 +50,7 @@ class GovernanceManager { try { await hostClient.connect(); candidateId = await hostClient.propose(hashes, shortName).catch(e => { - let err; - if (e.code === "tecHOOK_REJECTED" && e.hookExecutionResult) { - err = e.hookExecutionResult.map(o => o.message).join(', '); - } - throw err || e.code || 'PROPOSE_TX_ERR'; + throw (typeof e == 'object' ? (e.code || 'PROPOSE_TX_ERR') : e); }); } finally { await hostClient.disconnect(); @@ -75,11 +71,7 @@ class GovernanceManager { throw `Trying to remove governance candidate which is not owned by host.`; await hostClient.withdraw(candidateId).catch(e => { - let err; - if (e.code === "tecHOOK_REJECTED" && e.hookExecutionResult) { - err = e.hookExecutionResult.map(o => o.message).join(', '); - } - throw err || e.code || 'WITHDRAW_TX_ERR'; + throw (typeof e == 'object' ? (e.code || 'WITHDRAW_TX_ERR') : e); }); } finally { await hostClient.disconnect();