diff options
author | 2023-04-08 02:38:31 +1000 | |
---|---|---|
committer | 2023-04-08 02:38:31 +1000 | |
commit | 2b424f5a8090961db0d8224f755b2dff7c9e9a8c (patch) | |
tree | 97da90487cbdefff24bcccc57f8a874b9ac8c929 /src/osd | |
parent | 9bda81283d963ee04dba90901f89c6f264ed3f3b (diff) |
Restored ability of for image devices to report specific error messages.
Restores ability to give specific/detailed messages removed in
6f7e4141ea14acaaf9cb973c66788fabb3457023 while pandering to obsession
with single return value.
Moved responsibility for displaying the error message in the UI to the
caller rather than device_image_interface, and made
device_image_interface always log the error along with the full path and
error condition content.
Gave several image devices more detailed error messages. Added some
FIXME comments for apparent bugs.
Diffstat (limited to 'src/osd')
-rw-r--r-- | src/osd/modules/debugger/debugimgui.cpp | 6 | ||||
-rw-r--r-- | src/osd/modules/debugger/qt/mainwindow.cpp | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp index a6f4554f75a..c216a106f1a 100644 --- a/src/osd/modules/debugger/debugimgui.cpp +++ b/src/osd/modules/debugger/debugimgui.cpp @@ -995,18 +995,18 @@ void debug_imgui::mount_image() void debug_imgui::create_image() { - std::error_condition res; + std::pair<std::error_condition, std::string> res; auto *fd = dynamic_cast<floppy_image_device *>(m_dialog_image); if(fd != nullptr) { res = fd->create(m_path,nullptr,nullptr); - if(!res) + if(!res.first) fd->setup_write(m_typelist.at(m_format_sel).format); } else res = m_dialog_image->create(m_path,nullptr,nullptr); - if(!res) + if(!res.first) ImGui::CloseCurrentPopup(); // TODO: add a messagebox to display on an error } diff --git a/src/osd/modules/debugger/qt/mainwindow.cpp b/src/osd/modules/debugger/qt/mainwindow.cpp index f707804537d..5e97376aa7d 100644 --- a/src/osd/modules/debugger/qt/mainwindow.cpp +++ b/src/osd/modules/debugger/qt/mainwindow.cpp @@ -375,10 +375,10 @@ void MainWindow::mountImage(bool changedTo) QDir::currentPath(), tr("All files (*.*)")); - std::error_condition err = img->load(filename.toUtf8().data()); + auto [err, message] = img->load(filename.toUtf8().data()); if (err) { - m_machine.debugger().console().printf("Image could not be mounted: %s\n", err.message()); + m_machine.debugger().console().printf("Image could not be mounted: %s\n", !message.empty() ? message : err.message()); return; } |