From 9842b2f1cec3f44cd498bda7c803454533d526b9 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Wed, 12 Aug 2020 16:37:15 -0230 Subject: [PATCH] Fix no-useless-catch issues (#9198) See [`no-useless-catch`](https://eslint.org/docs/rules/no-useless-catch) for more information. This change enables `no-useless-catch` and fixes the issues raised by the rule. --- .eslintrc.js | 1 + app/scripts/metamask-controller.js | 14 +++----------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 11460c5f5..37619720d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -48,6 +48,7 @@ module.exports = { 'global-require': 'error', 'guard-for-in': 'error', 'no-case-declarations': 'error', + 'no-useless-catch': 'error', /* End v2 rules */ 'arrow-parens': 'error', 'no-tabs': 'error', diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 9c11d8142..7cc6445a0 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -601,8 +601,6 @@ export default class MetamaskController extends EventEmitter { this.selectFirstIdentity() } return vault - } catch (err) { - throw err } finally { releaseLock() } @@ -658,8 +656,6 @@ export default class MetamaskController extends EventEmitter { this.preferencesController.setAddresses(accounts) this.selectFirstIdentity() return vault - } catch (err) { - throw err } finally { releaseLock() } @@ -1402,13 +1398,9 @@ export default class MetamaskController extends EventEmitter { * @returns {Object} - MetaMask state */ async createCancelTransaction (originalTxId, customGasPrice) { - try { - await this.txController.createCancelTransaction(originalTxId, customGasPrice) - const state = await this.getState() - return state - } catch (error) { - throw error - } + await this.txController.createCancelTransaction(originalTxId, customGasPrice) + const state = await this.getState() + return state } async createSpeedUpTransaction (originalTxId, customGasPrice, customGasLimit) {