Skip to content

Commit 97c4de9

Browse files
committed
*: throw new Error over assert(false, ...
1 parent 41c102b commit 97c4de9

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/address.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Address.fromOutputScript = function (script, network) {
3737
if (scripts.isPubKeyHashOutput(script)) return new Address(script.chunks[2], network.pubKeyHash)
3838
if (scripts.isScriptHashOutput(script)) return new Address(script.chunks[1], network.scriptHash)
3939

40-
assert(false, script.toASM() + ' has no matching Address')
40+
throw new Error(script.toASM() + ' has no matching Address')
4141
}
4242

4343
Address.prototype.toBase58Check = function () {
@@ -54,7 +54,7 @@ Address.prototype.toOutputScript = function () {
5454
if (scriptType === 'pubkeyhash') return scripts.pubKeyHashOutput(this.hash)
5555
if (scriptType === 'scripthash') return scripts.scriptHashOutput(this.hash)
5656

57-
assert(false, this.toString() + ' has no matching Script')
57+
throw new Error(this.toString() + ' has no matching Script')
5858
}
5959

6060
Address.prototype.toString = Address.prototype.toBase58Check

src/ecpair.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function findNetworkByWIFVersion (version) {
1717
if (network.wif === version) return network
1818
}
1919

20-
assert(false, 'Unknown network')
20+
throw new Error('Unknown network')
2121
}
2222

2323
function ECPair (d, Q, options) {

src/hdnode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function findBIP32NetworkByVersion (version) {
2020
}
2121
}
2222

23-
assert(false, 'Could not find network for ' + version.toString(16))
23+
throw new Error('Could not find network for ' + version.toString(16))
2424
}
2525

2626
function HDNode (keyPair, chainCode) {

0 commit comments

Comments
 (0)