fix issue where empty broadcast did not handle the error response appropriately
This commit is contained in:
parent
1f3b878d63
commit
e18b634c4e
1 changed files with 2 additions and 8 deletions
|
@ -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('<span class="glyphicon glyphicon-exclamation-sign"></span>');
|
||||
},
|
||||
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('<span class="glyphicon glyphicon-exclamation-sign"></span>');
|
||||
// console.error(JSON.stringify(data, null, 4));
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue