]> sigrok.org Git - pulseview.git/commitdiff
Save data: Catch Error exception
authorRalf <redacted>
Sun, 10 Jan 2021 12:43:51 +0000 (13:43 +0100)
committerSoeren Apel <redacted>
Tue, 22 Jun 2021 17:25:19 +0000 (19:25 +0200)
How to reproduce: Save data to Read-Only disk

pv/storesession.cpp

index ed0b0defaaac41034bdf843e5858cae89f40fe19..182642ee9aba08757269c43e208cf3b7147d5ef5 100644 (file)
@@ -301,10 +301,14 @@ void StoreSession::store_proc(vector< shared_ptr<data::SignalBase> > 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;