summaryrefslogtreecommitdiff
path: root/Userland/Services
diff options
context:
space:
mode:
authorMaciej <sppmacd@pm.me>2022-01-03 09:28:53 +0100
committerAndreas Kling <kling@serenityos.org>2022-01-03 15:44:56 +0100
commite824a2da90d2a3767cb6ce1ba2138a35f38103ab (patch)
tree79db1571e0756ba1c9376ce0c15ff9cf520528c8 /Userland/Services
parent022b4165702a52eac4aa581f190ae3e2f60e9529 (diff)
downloadserenity-e824a2da90d2a3767cb6ce1ba2138a35f38103ab.zip
WebServer: Make ErrorOr unwrapping more idiomatic
This still not propagates errors properly, but is at least (more) consistent with the codebase.
Diffstat (limited to 'Userland/Services')
-rw-r--r--Userland/Services/WebServer/Client.cpp10
-rw-r--r--Userland/Services/WebServer/main.cpp3
2 files changed, 6 insertions, 7 deletions
diff --git a/Userland/Services/WebServer/Client.cpp b/Userland/Services/WebServer/Client.cpp
index dcb3e776b2..7c2869eadd 100644
--- a/Userland/Services/WebServer/Client.cpp
+++ b/Userland/Services/WebServer/Client.cpp
@@ -226,9 +226,8 @@ static String folder_image_data()
{
static String cache;
if (cache.is_empty()) {
- auto file_or_error = Core::MappedFile::map("/res/icons/16x16/filetype-folder.png");
- VERIFY(!file_or_error.is_error());
- cache = encode_base64(file_or_error.value()->bytes());
+ auto file = Core::MappedFile::map("/res/icons/16x16/filetype-folder.png").release_value_but_fixme_should_propagate_errors();
+ cache = encode_base64(file->bytes());
}
return cache;
}
@@ -237,9 +236,8 @@ static String file_image_data()
{
static String cache;
if (cache.is_empty()) {
- auto file_or_error = Core::MappedFile::map("/res/icons/16x16/filetype-unknown.png");
- VERIFY(!file_or_error.is_error());
- cache = encode_base64(file_or_error.value()->bytes());
+ auto file = Core::MappedFile::map("/res/icons/16x16/filetype-unknown.png").release_value_but_fixme_should_propagate_errors();
+ cache = encode_base64(file->bytes());
}
return cache;
}
diff --git a/Userland/Services/WebServer/main.cpp b/Userland/Services/WebServer/main.cpp
index 51e805d1dd..f5f02cbb6b 100644
--- a/Userland/Services/WebServer/main.cpp
+++ b/Userland/Services/WebServer/main.cpp
@@ -84,7 +84,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return;
}
- VERIFY(!maybe_buffered_socket.value().set_blocking(true).is_error());
+ // FIXME: Propagate errors
+ MUST(maybe_buffered_socket.value().set_blocking(true));
auto client = WebServer::Client::construct(maybe_buffered_socket.release_value(), server);
client->start();
};