1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:47:44 +00:00

HexEditor: Propagate errors when using "Save as"

This commit is contained in:
Lucas CHOLLET 2023-01-14 22:04:20 -05:00 committed by Andrew Kaster
parent 3d914247cc
commit 2bba743c24
5 changed files with 25 additions and 31 deletions

View file

@ -146,8 +146,8 @@ HexEditorWidget::HexEditorWidget()
if (response.is_error())
return;
auto file = response.release_value();
if (!m_editor->save_as(file.release_stream())) {
GUI::MessageBox::show(window(), "Unable to save file.\n"sv, "Error"sv, GUI::MessageBox::Type::Error);
if (auto result = m_editor->save_as(file.release_stream()); result.is_error()) {
GUI::MessageBox::show(window(), DeprecatedString::formatted("Unable to save file: {}\n"sv, result.error()), "Error"sv, GUI::MessageBox::Type::Error);
return;
}