Exception handling in TxSearch

pull/93/merge
moneroexamples 6 years ago
parent 6e069cad80
commit f97b86ef75

@ -49,6 +49,7 @@ thinwalletCtrls.controller('AccountCtrl', function($scope, $rootScope, $http, $q
$scope.transactions = [];
$scope.blockchain_height = 0;
$scope.error = "";
// var private_view_key = AccountService.getViewKey();
@ -122,6 +123,14 @@ thinwalletCtrls.controller('AccountCtrl', function($scope, $rootScope, $http, $q
var data = response.data;
if (data.status === "error")
{
$scope.error = "An error occured in fetchAddressInfo: "
+ data.reason;
$scope.transactions = [];
return;
}
var promises = [];
var view_only = AccountService.isViewOnly();
@ -181,6 +190,14 @@ thinwalletCtrls.controller('AccountCtrl', function($scope, $rootScope, $http, $q
var data = response.data;
if (data.status === "error")
{
$scope.error = "An error occured in fetchTransactions: "
+ data.reason;
$scope.transactions = [];
return;
}
var scanned_block_timestamp = data.scanned_block_timestamp || 0;
if (scanned_block_timestamp > 0)

@ -50,6 +50,9 @@
<div class="received-div" ng-repeat="tx in transactions | limitTo:10">
<transaction></transaction>
</div>
<div class="w-form-fail error-backing" style="display: block;" ng-show="!!error">
<p>{{error}}</p>
</div>
</div>
</div>
</div>

@ -39,8 +39,11 @@
<div class="received-div" ng-repeat="tx in transactions | orderBy:predicate:reverse | startFrom:pageNum*pageSize | limitTo:pageSize">
<transaction></transaction>
</div>
<div class="w-form-fail error-backing" style="display: block;" ng-show="!!error">
<p>{{error}}</p>
</div>
<a class="table-btn left pointer" ng-click="navigatePage(1)">&lt;&lt; Previous 20</a>
<a class="table-btn right pointer" ng-click="navigatePage(-1)">Next 20 &gt;&gt;</a>
</div>
</div>
</div>
</div>

@ -48,10 +48,10 @@ CurrentBlockchainStatus::monitor_blockchain()
OMINFO << "Current blockchain height: " << current_height
<< ", no of mempool txs: " << mempool_txs.size();
clean_search_thread_map();
check_search_threads_for_exceptions();
clean_search_thread_map();
std::this_thread::sleep_for(
std::chrono::seconds(
bc_setup.refresh_block_status_every_seconds));
@ -980,9 +980,10 @@ CurrentBlockchainStatus::check_search_threads_for_exceptions()
found_any_exception = true;
std::rethrow_exception(eptr);
}
catch (const std::exception& e)
catch (std::exception const& e)
{
OMERROR << "Error in search thread: " << e.what();
OMERROR << "Error in search thread: " << e.what()
<< ". It will be cleared.";
}
}
}

@ -289,8 +289,7 @@ TxSearch::operator()()
if (tx_mysql_id == 0)
{
throw TxSearchException("tx_mysql_id is zero!");
//todo what should be done when insert_tx fails?
throw TxSearchException("tx_mysql_id is zero!");
}
vector<XmrOutput> outputs_found;
@ -341,7 +340,6 @@ TxSearch::operator()()
} // if (!found_mine_outputs.empty())
// SECOND component: Checking for our key images, i.e., inputs.
// no need mutex here, as this will be exectued only after
@ -499,8 +497,7 @@ TxSearch::operator()()
// it already
// exisits in the MySQL. So maybe can now
// check if we have it and get tx_mysql_id this
// way.
//todo what should be done when insert_tx fails?
// way.
}
} // if (tx_mysql_id == 0)

Loading…
Cancel
Save