Changes client errors in propose and withdraw (#239)

This commit is contained in:
Chalith Desaman
2023-03-30 19:28:13 +05:30
committed by GitHub
parent b2b867af19
commit 6ec372add1

View File

@@ -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();