1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:27:45 +00:00

HexEditor: Propagate errors when using "Save"

This commit is contained in:
Lucas CHOLLET 2023-01-14 22:09:43 -05:00 committed by Andrew Kaster
parent 2bba743c24
commit a2dca2b762
5 changed files with 13 additions and 13 deletions

View file

@ -132,8 +132,8 @@ HexEditorWidget::HexEditorWidget()
if (m_path.is_empty())
return m_save_as_action->activate();
if (!m_editor->save()) {
GUI::MessageBox::show(window(), "Unable to save file.\n"sv, "Error"sv, GUI::MessageBox::Type::Error);
if (auto result = m_editor->save(); result.is_error()) {
GUI::MessageBox::show(window(), DeprecatedString::formatted("Unable to save file: {}\n"sv, result.error()), "Error"sv, GUI::MessageBox::Type::Error);
} else {
window()->set_modified(false);
m_editor->update();