mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 02:08:12 +03:00
WebServer: Make ErrorOr unwrapping more idiomatic
This still not propagates errors properly, but is at least (more) consistent with the codebase.
This commit is contained in:
parent
022b416570
commit
e824a2da90
Notes:
sideshowbarker
2024-07-17 21:45:51 +09:00
Author: https://github.com/sppmacd Commit: https://github.com/SerenityOS/serenity/commit/e824a2da90d Pull-request: https://github.com/SerenityOS/serenity/pull/11591 Reviewed-by: https://github.com/Hendiadyoin1
@ -226,9 +226,8 @@ static String folder_image_data()
|
|||||||
{
|
{
|
||||||
static String cache;
|
static String cache;
|
||||||
if (cache.is_empty()) {
|
if (cache.is_empty()) {
|
||||||
auto file_or_error = Core::MappedFile::map("/res/icons/16x16/filetype-folder.png");
|
auto file = Core::MappedFile::map("/res/icons/16x16/filetype-folder.png").release_value_but_fixme_should_propagate_errors();
|
||||||
VERIFY(!file_or_error.is_error());
|
cache = encode_base64(file->bytes());
|
||||||
cache = encode_base64(file_or_error.value()->bytes());
|
|
||||||
}
|
}
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
@ -237,9 +236,8 @@ static String file_image_data()
|
|||||||
{
|
{
|
||||||
static String cache;
|
static String cache;
|
||||||
if (cache.is_empty()) {
|
if (cache.is_empty()) {
|
||||||
auto file_or_error = Core::MappedFile::map("/res/icons/16x16/filetype-unknown.png");
|
auto file = Core::MappedFile::map("/res/icons/16x16/filetype-unknown.png").release_value_but_fixme_should_propagate_errors();
|
||||||
VERIFY(!file_or_error.is_error());
|
cache = encode_base64(file->bytes());
|
||||||
cache = encode_base64(file_or_error.value()->bytes());
|
|
||||||
}
|
}
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||||||
return;
|
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);
|
auto client = WebServer::Client::construct(maybe_buffered_socket.release_value(), server);
|
||||||
client->start();
|
client->start();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user