chore: consolidate,add try blocks, throw more
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
44a2f4148e
commit
7972a851a0
@ -76,7 +76,8 @@ auto Accumulator::get_random_data(const unsigned int& n_bytes) -> std::string {
|
|||||||
data = this->Gen->generate_random_data(n_bytes);
|
data = this->Gen->generate_random_data(n_bytes);
|
||||||
}
|
}
|
||||||
catch (std::exception& e) {
|
catch (std::exception& e) {
|
||||||
fmt::print("{}", e.what());
|
// FIXME: handle the exception
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -86,7 +87,8 @@ auto Accumulator::call_reseed(const std::string& seed) -> void {
|
|||||||
this->Gen->reseed(seed);
|
this->Gen->reseed(seed);
|
||||||
}
|
}
|
||||||
catch (std::exception& e) {
|
catch (std::exception& e) {
|
||||||
fmt::print("{}", e.what());
|
// FIXME: handle the exception
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <exception>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void add(const std::vector<char>& event) override {
|
void add(const std::vector<char>& event) override {
|
||||||
|
try {
|
||||||
this->pool_id = (this->where_to) % 32;
|
this->pool_id = (this->where_to) % 32;
|
||||||
fmt::print("[i] add to pool {}\n", this->pool_id);
|
fmt::print("[i] add to pool {}\n", this->pool_id);
|
||||||
int ret{this->_pools->at(this->pool_id)
|
int ret{this->_pools->at(this->pool_id)
|
||||||
@ -50,6 +52,10 @@ public:
|
|||||||
// FIXME: this WILL overflow, too
|
// FIXME: this WILL overflow, too
|
||||||
++where_to;
|
++where_to;
|
||||||
}
|
}
|
||||||
|
catch (std::exception& e) {
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace accumulator
|
} // namespace accumulator
|
||||||
|
@ -46,17 +46,19 @@ auto UrandomEntropySrc::event(accumulator::EventAdderImpl& adder) -> void {
|
|||||||
fmt::print(stderr, "{}", msg);
|
fmt::print(stderr, "{}", msg);
|
||||||
throw std::runtime_error(msg);
|
throw std::runtime_error(msg);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (std::ifstream::failure& e) {
|
|
||||||
fmt::print("io exception caugth: {}\n", e.what());
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
adder.add(this->bytes);
|
adder.add(this->bytes);
|
||||||
std::memset(this->bytes.data(), 0x00, this->bytes.size()); // clear out
|
std::memset(this->bytes.data(), 0x00, this->bytes.size()); // clear out
|
||||||
}
|
}
|
||||||
|
catch (std::ifstream::failure& e) {
|
||||||
|
// FIXME: handle the exception
|
||||||
|
fmt::print("io exception caugth: {}\n", e.what());
|
||||||
|
throw;
|
||||||
|
}
|
||||||
catch (std::exception& e) {
|
catch (std::exception& e) {
|
||||||
|
// FIXME: handle the exception
|
||||||
fmt::print("[!] ues: exception caugth: {}\n", e.what());
|
fmt::print("[!] ues: exception caugth: {}\n", e.what());
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user