From f9319755734823208210b1e244b827ecb6820346 Mon Sep 17 00:00:00 2001 From: Ralf Date: Sun, 10 Jan 2021 13:43:51 +0100 Subject: [PATCH] Save data: Catch Error exception How to reproduce: Save data to Read-Only disk --- pv/storesession.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pv/storesession.cpp b/pv/storesession.cpp index ed0b0def..182642ee 100644 --- a/pv/storesession.cpp +++ b/pv/storesession.cpp @@ -301,10 +301,14 @@ void StoreSession::store_proc(vector< shared_ptr > achannel_li units_stored_ = unit_count_ - (sample_count_ >> progress_scale); } - auto dfend = context->create_end_packet(); - const string ldata_str = output_->receive(dfend); - if (output_stream_.is_open()) - output_stream_ << ldata_str; + try { + auto dfend = context->create_end_packet(); + const string ldata_str = output_->receive(dfend); + if (output_stream_.is_open()) + output_stream_ << ldata_str; + } catch (Error& error) { + error_ = tr("Error while saving: ") + error.what(); + } // Zeroing the progress variables indicates completion units_stored_ = unit_count_ = 0; -- 2.30.2