Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonarcloud #288

Merged
merged 6 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CryptoNoteCore/BlockIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace cn {
{
assert(m_index.count(startBlockId) > 0);

uint32_t startBlockHeight;
uint32_t startBlockHeight = 0;
std::vector<crypto::Hash> result;
if (getBlockHeight(startBlockId, startBlockHeight))
{
Expand Down
4 changes: 3 additions & 1 deletion src/NodeRpcProxy/NodeRpcProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ void NodeRpcProxy::workerThread(const INode::Callback& initialized_callback) {
contextGroup.wait();
// Make sure all remote spawns are executed
m_dispatcher->yield();
} catch (std::exception&) {
} catch (std::exception& e) {
// TODO Make this pass through file log
std::cout << "Exception while attempting to make a worker thread: " << e.what();
}

m_dispatcher = nullptr;
Expand Down
8 changes: 4 additions & 4 deletions src/Rpc/HttpClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ void HttpClient::disconnect() {
m_streamBuf.reset();
try {
m_connection.write(nullptr, 0); //Socket shutdown.
} catch (std::exception&) {
//Ignoring possible exception.
} catch (std::exception& e) {
throw ConnectException(e.what());
}

try {
m_connection = platform_system::TcpConnection();
} catch (std::exception&) {
//Ignoring possible exception.
} catch (std::exception& e) {
throw ConnectException(e.what());
}

m_connected = false;
Expand Down
5 changes: 3 additions & 2 deletions src/Rpc/HttpServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ void HttpServer::acceptLoop() {
accepted = true;
} catch (platform_system::InterruptedException&) {
throw;
} catch (std::exception&) {
// try again
} catch (std::exception& e) {
logger(WARNING) << "Exception while trying to accept the loop, trying again.";
}
}

Expand Down Expand Up @@ -120,6 +120,7 @@ void HttpServer::acceptLoop() {
logger(DEBUGGING) << "Closing connection from " << addr.first.toDottedDecimal() << ":" << addr.second << " total=" << m_connections.size();

} catch (platform_system::InterruptedException&) {
throw;
} catch (std::exception& e) {
logger(DEBUGGING) << "Connection error: " << e.what();
}
Expand Down
1 change: 1 addition & 0 deletions src/Wallet/WalletGreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2817,6 +2817,7 @@ namespace cn
}
catch (...)
{
m_logger(WARNING, BRIGHT_RED) << "Rollback has failed. The TX will be stored as unconfirmed and will be deleted after the wallet is relaunched during TX pool sync.";
// Ignore any exceptions. If rollback fails then the transaction is stored as unconfirmed and will be deleted after wallet relaunch
// during transaction pool synchronization
}
Expand Down
4 changes: 3 additions & 1 deletion src/WalletLegacy/WalletLegacy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,10 @@ void WalletLegacy::doLoad(std::istream& source) {
std::stringstream stream(cache);
m_transfersSync.load(stream);
}
} catch (const std::exception&) {
} catch (const std::exception& e) {
// TODO Make this pass through file log at some point
// ignore cache loading errors
std::cout << "Exception during loading cache: " << e.what() << std::endl;
}
// Read all output keys cache
std::vector<TransactionOutputInformation> allTransfers;
Expand Down