pool: refactor try-catch-throw logic (a little)
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-01-20 02:23:33 +01:00
parent 422eb6fd8d
commit 44a2f4148e
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

View File

@ -60,6 +60,7 @@ auto Pool::add_entropy(const unsigned int& source,
}
catch (const std::exception& e) {
fmt::print("{}\n", e.what());
throw;
}
fmt::print("\tall_ok: {}\n", all_ok);
@ -69,13 +70,7 @@ auto Pool::add_entropy(const unsigned int& source,
event_str.assign(event.begin(), event.end());
fmt::print("\tevent_str length: {}\n", event_str.length());
}
catch (const std::exception& e) {
fmt::print("\t[!] add_entropy: {}\n", e.what());
throw std::runtime_error(e.what());
}
try {
// FIXME: check size for overflow
// also, atm this counts event size but actually what gets appended
// are digests of 64 characters (hex-encoded 32 bytes)
@ -103,6 +98,8 @@ auto Pool::add_entropy(const unsigned int& source,
}
catch (const std::exception& e) {
fmt::print("[!] pool(add_entropy): {}\n", e.what());
// FIXME: handle this (as all the other unhandled exceptions)
throw;
}
return 0;