Catch exceptions from litelib_initialize_existing
This commit is contained in:
@@ -149,20 +149,30 @@ void ConnectionLoader::doAutoConnect()
|
|||||||
if (litelib_wallet_exists(Settings::getDefaultChainName().toStdString().c_str())) {
|
if (litelib_wallet_exists(Settings::getDefaultChainName().toStdString().c_str())) {
|
||||||
qDebug() << __func__ << ": using existing wallet";
|
qDebug() << __func__ << ": using existing wallet";
|
||||||
main->logger->write(QObject::tr("Using existing wallet."));
|
main->logger->write(QObject::tr("Using existing wallet."));
|
||||||
char* resp = litelib_initialize_existing(
|
|
||||||
config->dangerous,
|
|
||||||
config->server.toStdString().c_str()
|
|
||||||
);
|
|
||||||
QString response = litelib_process_response(resp);
|
|
||||||
|
|
||||||
if (response.toUpper().trimmed() != "OK") {
|
QString response = "";
|
||||||
config->server = Settings::getRandomServer();
|
try {
|
||||||
|
char* resp = litelib_initialize_existing(
|
||||||
resp = litelib_initialize_existing(
|
|
||||||
config->dangerous,
|
config->dangerous,
|
||||||
config->server.toStdString().c_str()
|
config->server.toStdString().c_str()
|
||||||
);
|
);
|
||||||
response = litelib_process_response(resp);
|
response = litelib_process_response(resp);
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
qDebug() << __func__ << ": caught an exception, ignoring: " << e.what();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.toUpper().trimmed() != "OK") {
|
||||||
|
config->server = Settings::getRandomServer();
|
||||||
|
|
||||||
|
try {
|
||||||
|
char* resp = litelib_initialize_existing(
|
||||||
|
config->dangerous,
|
||||||
|
config->server.toStdString().c_str()
|
||||||
|
);
|
||||||
|
response = litelib_process_response(resp);
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
qDebug() << __func__ << ": caught an exception, ignoring: " << e.what();
|
||||||
|
}
|
||||||
|
|
||||||
if (response.toUpper().trimmed() != "OK") {
|
if (response.toUpper().trimmed() != "OK") {
|
||||||
QString resp = "Error when connecting to " + config->server + ": " + response;
|
QString resp = "Error when connecting to " + config->server + ": " + response;
|
||||||
|
|||||||
Reference in New Issue
Block a user