]> sigrok.org Git - pulseview.git/commitdiff
Session: Fix issue #67 by improving error handling
authorSoeren Apel <redacted>
Thu, 14 Mar 2024 20:58:47 +0000 (21:58 +0100)
committerSoeren Apel <redacted>
Thu, 14 Mar 2024 20:59:45 +0000 (21:59 +0100)
pv/session.cpp

index f1a153e7e44932518b34566c3cdfac2d77001b99..b4ecc6a87c2f4886c3a812df1191cea08542e4f8 100644 (file)
@@ -614,6 +614,9 @@ void Session::set_device(shared_ptr<devices::Device> device)
        } catch (const QString &e) {
                device_.reset();
                MainWindow::show_session_error(tr("Failed to open device"), e);
+       } catch (const sigrok::Error &e) {
+               device_.reset();
+               MainWindow::show_session_error(tr("Failed to open device"), QString(e.what()));
        }
 
        if (device_) {
@@ -756,8 +759,11 @@ void Session::load_file(QString file_name, QString setup_file_name,
                                        file_name.toStdString())));
        } catch (Error& e) {
                MainWindow::show_session_error(tr("Failed to load %1").arg(file_name), e.what());
-               set_default_device();
-               main_bar_->update_device_list();
+               return;
+       }
+
+       if (!device_) {
+               MainWindow::show_session_error(errorMessage, "");
                return;
        }