From e18b634c4ee64addf6c85b4e2b3744f490a836bc Mon Sep 17 00:00:00 2001 From: Wowee0 Date: Tue, 27 Aug 2019 11:17:08 -0500 Subject: [PATCH] fix issue where empty broadcast did not handle the error response appropriately --- js/coinbin.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/js/coinbin.js b/js/coinbin.js index ba3d5a5..69f266d 100644 --- a/js/coinbin.js +++ b/js/coinbin.js @@ -1363,10 +1363,7 @@ $(document).ready(function() { url: "https://api.blockcypher.com/v1/"+network+"/main/txs/push", data: JSON.stringify({"tx":$("#rawTransaction").val()}), error: function(data) { - var obj = $.parseJSON(data.responseText); - var r = ' '; - r += (obj.error) ? obj.error : ''; - r = (r!='') ? r : ' Failed to broadcast'; // build response + var r = 'Failed to broadcast: error code=' + data.status.toString() + ' ' + data.statusText; $("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').removeClass("hidden").html(r).prepend(''); }, success: function(data) { @@ -1393,10 +1390,7 @@ $(document).ready(function() { data: {"data":$("#rawTransaction").val()}, dataType: "json", error: function(data) { - var obj = $.parseJSON(data.responseText); - var r = ' '; - r += (obj.data.tx_hex) ? ' '+obj.data.tx_hex : ''; - r = (r!='') ? r : ' Failed to broadcast'; // build response + var r = 'Failed to broadcast: error code=' + data.status.toString() + ' ' + data.statusText; $("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').removeClass("hidden").html(r).prepend(''); // console.error(JSON.stringify(data, null, 4)); },