mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-17 08:18:07 -04:00
chore: propagate exceptions in filesystem_writer
This commit is contained in:
parent
4abbdf09ab
commit
b2f368bce0
@ -346,11 +346,13 @@ class rewritten_fsblock : public fsblock::impl {
|
||||
std::promise<void> prom;
|
||||
future_ = prom.get_future();
|
||||
|
||||
wg.add_job([this, prom = std::move(prom),
|
||||
meta = std::move(meta)]() mutable {
|
||||
wg.add_job(
|
||||
[this, prom = std::move(prom), meta = std::move(meta)]() mutable {
|
||||
try {
|
||||
// TODO: we don't have to do this for uncompressed blocks
|
||||
std::vector<uint8_t> block;
|
||||
block_decompressor bd(data_comp_type_, data_.data(), data_.size(), block);
|
||||
block_decompressor bd(data_comp_type_, data_.data(), data_.size(),
|
||||
block);
|
||||
bd.decompress_frame(bd.uncompressed_size());
|
||||
|
||||
if (!meta) {
|
||||
@ -377,10 +379,13 @@ class rewritten_fsblock : public fsblock::impl {
|
||||
}
|
||||
|
||||
prom.set_value();
|
||||
} catch (...) {
|
||||
prom.set_exception(std::current_exception());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void wait_until_compressed() override { future_.wait(); }
|
||||
void wait_until_compressed() override { future_.get(); }
|
||||
|
||||
section_type type() const override { return type_; }
|
||||
|
||||
@ -690,6 +695,7 @@ void filesystem_writer_<LoggerPolicy>::writer_thread() {
|
||||
|
||||
auto const& fsb = holder.value();
|
||||
|
||||
// TODO: this may throw
|
||||
fsb->wait_until_compressed();
|
||||
|
||||
LOG_DEBUG << get_section_name(fsb->type()) << " [" << fsb->block_no()
|
||||
|
Loading…
x
Reference in New Issue
Block a user