From: Soeren Apel Date: Thu, 14 Mar 2024 20:58:47 +0000 (+0100) Subject: Session: Fix issue #67 by improving error handling X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d00efc65ef47090b71c4da12797056033bee795f;p=pulseview.git Session: Fix issue #67 by improving error handling --- diff --git a/pv/session.cpp b/pv/session.cpp index f1a153e7..b4ecc6a8 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -614,6 +614,9 @@ void Session::set_device(shared_ptr 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; }