1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

AK: Use ErrorOr<T> for MappedFile factories

Replace Result<T, E> with ErrorOr<T> and propagate the error to callers.
This commit is contained in:
Andreas Kling 2021-11-07 00:37:07 +01:00
parent c837bd551e
commit 0f5477c721
12 changed files with 54 additions and 64 deletions

View file

@ -31,7 +31,7 @@ Result<void, String> ProjectLoader::try_load_from_fd_and_close(int fd, StringVie
auto file_or_error = MappedFile::map_from_fd_and_close(fd, path);
if (file_or_error.is_error())
return String::formatted("Unable to mmap file {}", file_or_error.error().string());
return String::formatted("Unable to mmap file {}", file_or_error.error());
auto& mapped_file = *file_or_error.value();
// FIXME: Find a way to avoid the memory copy here.