pool: refactor try-catch-throw logic (a little)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
422eb6fd8d
commit
44a2f4148e
9
pool.cpp
9
pool.cpp
|
@ -60,6 +60,7 @@ auto Pool::add_entropy(const unsigned int& source,
|
||||||
}
|
}
|
||||||
catch (const std::exception& e) {
|
catch (const std::exception& e) {
|
||||||
fmt::print("{}\n", e.what());
|
fmt::print("{}\n", e.what());
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
fmt::print("\tall_ok: {}\n", all_ok);
|
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());
|
event_str.assign(event.begin(), event.end());
|
||||||
|
|
||||||
fmt::print("\tevent_str length: {}\n", event_str.length());
|
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
|
// FIXME: check size for overflow
|
||||||
// also, atm this counts event size but actually what gets appended
|
// also, atm this counts event size but actually what gets appended
|
||||||
// are digests of 64 characters (hex-encoded 32 bytes)
|
// 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) {
|
catch (const std::exception& e) {
|
||||||
fmt::print("[!] pool(add_entropy): {}\n", e.what());
|
fmt::print("[!] pool(add_entropy): {}\n", e.what());
|
||||||
|
// FIXME: handle this (as all the other unhandled exceptions)
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Reference in New Issue