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

LibCore: Propagate errors from Stream::*_entire_buffer

This commit is contained in:
Tim Schumacher 2022-12-11 19:21:36 +01:00 committed by Andreas Kling
parent 6c7c5a6786
commit 9a3e95785e
17 changed files with 43 additions and 49 deletions

View file

@ -59,7 +59,6 @@ ErrorOr<JsonValue> read_entire_file_as_json(StringView filename)
auto file = TRY(Core::Stream::File::open(filename, Core::Stream::OpenMode::Read));
auto json_size = TRY(file->size());
auto json_data = TRY(ByteBuffer::create_uninitialized(json_size));
if (!file->read_entire_buffer(json_data.bytes()))
return Error::from_string_literal("Failed to read json file.");
TRY(file->read_entire_buffer(json_data.bytes()));
return JsonValue::from_string(json_data);
}