fix(Electrumx.blockHeader): Mocking negative test-case unit tests

This commit is contained in:
Chris Troutner
2020-10-11 15:39:17 -07:00
parent be3094fc77
commit 7ec8442540
3 changed files with 37 additions and 12 deletions
+10 -4
View File
@@ -441,8 +441,14 @@ class ElectrumX {
)
return response.data
} catch (error) {
if (error.response && error.response.data) throw error.response.data
else throw error
// console.log("error: ", error)
if (error.response && error.response.data) {
if (error.response && error.response.data)
throw new Error(error.response.data.error)
else throw error.response.data
} else {
throw error
}
}
}
@@ -515,7 +521,7 @@ class ElectrumX {
* }
* ]
* }
*/
*/
async txData(txid) {
try {
// Handle single transaction.
@@ -564,7 +570,7 @@ class ElectrumX {
* "success": true,
* "txid": "..."
* }
*/
*/
async broadcast(txHex) {
try {
if (typeof txHex === "string") {