Skip to content

Commit

Permalink
Session: Fix issue sigrokproject#67 by improving error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
abraxa committed Mar 14, 2024
1 parent 9b8b734 commit d00efc6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pv/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_) {
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit d00efc6

Please sign in to comment.