*: throw new Error over assert(false, ...

This commit is contained in:
Daniel Cousens 2015-06-23 16:43:17 +10:00
parent 41c102be66
commit 97c4de9da6
3 changed files with 4 additions and 4 deletions

View file

@ -37,7 +37,7 @@ Address.fromOutputScript = function (script, network) {
if (scripts.isPubKeyHashOutput(script)) return new Address(script.chunks[2], network.pubKeyHash) if (scripts.isPubKeyHashOutput(script)) return new Address(script.chunks[2], network.pubKeyHash)
if (scripts.isScriptHashOutput(script)) return new Address(script.chunks[1], network.scriptHash) if (scripts.isScriptHashOutput(script)) return new Address(script.chunks[1], network.scriptHash)
assert(false, script.toASM() + ' has no matching Address') throw new Error(script.toASM() + ' has no matching Address')
} }
Address.prototype.toBase58Check = function () { Address.prototype.toBase58Check = function () {
@ -54,7 +54,7 @@ Address.prototype.toOutputScript = function () {
if (scriptType === 'pubkeyhash') return scripts.pubKeyHashOutput(this.hash) if (scriptType === 'pubkeyhash') return scripts.pubKeyHashOutput(this.hash)
if (scriptType === 'scripthash') return scripts.scriptHashOutput(this.hash) if (scriptType === 'scripthash') return scripts.scriptHashOutput(this.hash)
assert(false, this.toString() + ' has no matching Script') throw new Error(this.toString() + ' has no matching Script')
} }
Address.prototype.toString = Address.prototype.toBase58Check Address.prototype.toString = Address.prototype.toBase58Check

View file

@ -17,7 +17,7 @@ function findNetworkByWIFVersion (version) {
if (network.wif === version) return network if (network.wif === version) return network
} }
assert(false, 'Unknown network') throw new Error('Unknown network')
} }
function ECPair (d, Q, options) { function ECPair (d, Q, options) {

View file

@ -20,7 +20,7 @@ function findBIP32NetworkByVersion (version) {
} }
} }
assert(false, 'Could not find network for ' + version.toString(16)) throw new Error('Could not find network for ' + version.toString(16))
} }
function HDNode (keyPair, chainCode) { function HDNode (keyPair, chainCode) {