mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-05 04:26:15 -07:00
error output on exceptions in commit thread
This commit is contained in:
parent
08b1ceb9a1
commit
3cef1b0842
1 changed files with 16 additions and 1 deletions
|
@ -745,10 +745,13 @@ void CV2::commitThread()
|
|||
std::string networkId;
|
||||
try {
|
||||
pqxx::work w(*c->c);
|
||||
|
||||
|
||||
memberId = config["id"];
|
||||
networkId = config["nwid"];
|
||||
|
||||
std::string cfgDump = OSUtils::jsonDump(config, 2);
|
||||
fprintf(stderr, "Member save %s-%s: %s\n", networkId.c_str(), memberId.c_str(), cfgDump.c_str());
|
||||
|
||||
std::string target = "NULL";
|
||||
if (!config["remoteTraceTarget"].is_null()) {
|
||||
target = config["remoteTraceTarget"];
|
||||
|
@ -846,6 +849,12 @@ void CV2::commitThread()
|
|||
} else {
|
||||
fprintf(stderr, "%s: Can't notify of change. Error parsing nwid or memberid: %llu-%llu\n", _myAddressStr.c_str(), (unsigned long long)nwidInt, (unsigned long long)memberidInt);
|
||||
}
|
||||
} catch (pqxx::data_exception &e) {
|
||||
const pqxx::sql_error *s=dynamic_cast<const pqxx::sql_error *>(&e);
|
||||
fprintf(stderr, "%s ERROR: Error updating member: %s\n", _myAddressStr.c_str(), e.what());
|
||||
if (s) {
|
||||
fprintf(stderr, "%s ERROR: SQL error: %s\n", _myAddressStr.c_str(), s->query().c_str());
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
fprintf(stderr, "%s ERROR: Error updating member %s-%s: %s\n", _myAddressStr.c_str(), networkId.c_str(), memberId.c_str(), e.what());
|
||||
}
|
||||
|
@ -882,6 +891,12 @@ void CV2::commitThread()
|
|||
} else {
|
||||
fprintf(stderr, "%s: Can't notify network changed: %llu\n", _myAddressStr.c_str(), (unsigned long long)nwidInt);
|
||||
}
|
||||
} catch (pqxx::data_exception &e) {
|
||||
const pqxx::sql_error *s=dynamic_cast<const pqxx::sql_error *>(&e);
|
||||
fprintf(stderr, "%s ERROR: Error updating network: %s\n", _myAddressStr.c_str(), e.what());
|
||||
if (s) {
|
||||
fprintf(stderr, "%s ERROR: SQL error: %s\n", _myAddressStr.c_str(), s->query().c_str());
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
fprintf(stderr, "%s ERROR: Error updating network: %s\n", _myAddressStr.c_str(), e.what());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue