diff --git a/sstables/kl/reader.cc b/sstables/kl/reader.cc index e6dd356544..18eae4b64b 100644 --- a/sstables/kl/reader.cc +++ b/sstables/kl/reader.cc @@ -1120,6 +1120,12 @@ public: }); }); } + }).then_wrapped([this] (future<> f) { + try { + f.get(); + } catch(sstables::malformed_sstable_exception& e) { + throw sstables::malformed_sstable_exception(format("Failed to read partition from SSTable {} due to {}", _sst->get_filename(), e.what())); + } }); } virtual future<> next_partition() override { diff --git a/sstables/kl/reader_impl.hh b/sstables/kl/reader_impl.hh index 52eba9caaf..06dcad0bc2 100644 --- a/sstables/kl/reader_impl.hh +++ b/sstables/kl/reader_impl.hh @@ -189,11 +189,7 @@ public: // leave only the unprocessed part. The caller must handle calling // process() again, and/or refilling the buffer, as needed. data_consumer::processing_result process_state(temporary_buffer& data) { - try { - return do_process_state(data); - } catch (malformed_sstable_exception& exp) { - throw malformed_sstable_exception(exp.what(), _sst->get_filename()); - } + return do_process_state(data); } private: data_consumer::processing_result do_process_state(temporary_buffer& data) { diff --git a/sstables/mx/reader.cc b/sstables/mx/reader.cc index e7ac5d1144..437c1774ca 100644 --- a/sstables/mx/reader.cc +++ b/sstables/mx/reader.cc @@ -337,11 +337,7 @@ public: } data_consumer::processing_result process_state(temporary_buffer& data) { - try { - return do_process_state(data); - } catch (malformed_sstable_exception& exp) { - throw malformed_sstable_exception(exp.what(), _sst->get_filename()); - } + return do_process_state(data); } private: data_consumer::processing_result do_process_state(temporary_buffer& data) { @@ -1834,6 +1830,12 @@ public: }); }); } + }).then_wrapped([this] (future<> f) { + try { + f.get(); + } catch(sstables::malformed_sstable_exception& e) { + throw sstables::malformed_sstable_exception(format("Failed to read partition from SSTable {} due to {}", _sst->get_filename(), e.what())); + } }); } virtual future<> next_partition() override {