mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #899 from MetaMask/i893-DenodeifyKeyringController
Fix incorrect nodeification and add descriptive error to help find in future
This commit is contained in:
commit
5af4157363
@ -282,7 +282,7 @@ module.exports = class KeyringController extends EventEmitter {
|
|||||||
setSelectedAccount (address) {
|
setSelectedAccount (address) {
|
||||||
var addr = normalize(address)
|
var addr = normalize(address)
|
||||||
this.configManager.setSelectedAccount(addr)
|
this.configManager.setSelectedAccount(addr)
|
||||||
Promise.resolve(addr)
|
return Promise.resolve(addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save Account Label
|
// Save Account Label
|
||||||
|
@ -6,12 +6,19 @@ module.exports = function (promiseFn) {
|
|||||||
}
|
}
|
||||||
var cb = arguments[arguments.length - 1]
|
var cb = arguments[arguments.length - 1]
|
||||||
|
|
||||||
return promiseFn.apply(this, args)
|
const nodeified = promiseFn.apply(this, args)
|
||||||
.then(function (result) {
|
|
||||||
|
if (!nodeified) {
|
||||||
|
const methodName = String(promiseFn).split('(')[0]
|
||||||
|
throw new Error(`The ${methodName} did not return a Promise, but was nodeified.`)
|
||||||
|
}
|
||||||
|
nodeified.then(function (result) {
|
||||||
cb(null, result)
|
cb(null, result)
|
||||||
})
|
})
|
||||||
.catch(function (reason) {
|
.catch(function (reason) {
|
||||||
cb(reason)
|
cb(reason)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
return nodeified
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user