diff options
author | Tim Schumacher <timschumi@gmx.de> | 2022-12-11 19:21:36 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-12 14:16:42 +0100 |
commit | 9a3e95785e80a6b03e8d71605ddb603bb6776b69 (patch) | |
tree | abeba5b04e7b452041dc3054fbac56dc1b91d482 /Userland/DevTools | |
parent | 6c7c5a6786f5f168b9e228f9d4b41ed1e64bc8f3 (diff) | |
download | serenity-9a3e95785e80a6b03e8d71605ddb603bb6776b69.zip |
LibCore: Propagate errors from `Stream::*_entire_buffer`
Diffstat (limited to 'Userland/DevTools')
-rw-r--r-- | Userland/DevTools/SQLStudio/ScriptEditor.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Userland/DevTools/SQLStudio/ScriptEditor.cpp b/Userland/DevTools/SQLStudio/ScriptEditor.cpp index 0a4560e038..5b5d82f278 100644 --- a/Userland/DevTools/SQLStudio/ScriptEditor.cpp +++ b/Userland/DevTools/SQLStudio/ScriptEditor.cpp @@ -44,8 +44,7 @@ ErrorOr<bool> ScriptEditor::save() auto file = TRY(Core::Stream::File::open(m_path, Core::Stream::OpenMode::Write)); auto editor_text = text(); - if (editor_text.length() && !file->write_entire_buffer(editor_text.bytes())) - return Error::from_string_literal("Failed to write to file"); + TRY(file->write_entire_buffer(editor_text.bytes())); document().set_unmodified(); return true; @@ -60,8 +59,7 @@ ErrorOr<bool> ScriptEditor::save_as() auto file = TRY(Core::Stream::File::open(save_path, Core::Stream::OpenMode::Write)); auto editor_text = text(); - if (editor_text.length() && !file->write_entire_buffer(editor_text.bytes())) - return Error::from_string_literal("Failed to write to file"); + TRY(file->write_entire_buffer(editor_text.bytes())); m_path = save_path; |