aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/metamask-controller.js20
1 files changed, 17 insertions, 3 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index b8b7c38e4..2f114e9f0 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -561,10 +561,15 @@ module.exports = class MetamaskController extends EventEmitter {
return accounts
default:
- throw new Error('MetamaskController - Unknown device')
+ throw new Error('MetamaskController:connectHardware - Unknown device')
}
}
+ /**
+ * Check if the device is unlocked
+ *
+ * @returns {Promise<boolean>}
+ */
async checkHardwareStatus (deviceName) {
switch (deviceName) {
@@ -574,12 +579,19 @@ module.exports = class MetamaskController extends EventEmitter {
'Trezor Hardware'
)[0]
if (!keyring) {
- return false
+ throw new Error('MetamaskController:checkHardwareStatus - Trezor Hardware keyring not found')
}
return keyring.isUnlocked()
+ default:
+ throw new Error('MetamaskController:checkHardwareStatus - Unknown device')
}
}
+ /**
+ * Clear
+ *
+ * @returns {Promise<boolean>}
+ */
async forgetDevice (deviceName) {
switch (deviceName) {
@@ -589,10 +601,12 @@ module.exports = class MetamaskController extends EventEmitter {
'Trezor Hardware'
)[0]
if (!keyring) {
- return false
+ throw new Error('MetamaskController:forgetDevice - Trezor Hardware keyring not found')
}
keyring.forgetDevice()
return true
+ default:
+ throw new Error('MetamaskController:forgetDevice - Unknown device')
}
}