mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:38:11 +00:00
LibCore: Propagate errors from Stream::*_entire_buffer
This commit is contained in:
parent
6c7c5a6786
commit
9a3e95785e
17 changed files with 43 additions and 49 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue