diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-01-20 17:47:39 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-24 22:36:09 +0100 |
commit | 45cf40653a03dab11c0739783446ff696a9a5b0a (patch) | |
tree | 1611c797d1a43a106cf7220fcbdbba907f19d037 /Userland/Libraries/LibProtocol | |
parent | 140f1d9e55bfacb6f784bee591a6938714ed95b3 (diff) | |
download | serenity-45cf40653a03dab11c0739783446ff696a9a5b0a.zip |
Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOr
Apologies for the enormous commit, but I don't see a way to split this
up nicely. In the vast majority of cases it's a simple change. A few
extra places can use TRY instead of manual error checking though. :^)
Diffstat (limited to 'Userland/Libraries/LibProtocol')
-rw-r--r-- | Userland/Libraries/LibProtocol/RequestClient.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibProtocol/WebSocket.cpp | 4 |
2 files changed, 2 insertions, 4 deletions
diff --git a/Userland/Libraries/LibProtocol/RequestClient.cpp b/Userland/Libraries/LibProtocol/RequestClient.cpp index ac394def1f..00fda42af0 100644 --- a/Userland/Libraries/LibProtocol/RequestClient.cpp +++ b/Userland/Libraries/LibProtocol/RequestClient.cpp @@ -28,7 +28,7 @@ RefPtr<Request> RequestClient::start_request(String const& method, URL const& ur header_dictionary.add(it.key, it.value); auto body_result = ByteBuffer::copy(request_body); - if (!body_result.has_value()) + if (body_result.is_error()) return nullptr; auto response = IPCProxy::start_request(method, url, header_dictionary, body_result.release_value()); diff --git a/Userland/Libraries/LibProtocol/WebSocket.cpp b/Userland/Libraries/LibProtocol/WebSocket.cpp index c97f4027d3..88f8d7bb41 100644 --- a/Userland/Libraries/LibProtocol/WebSocket.cpp +++ b/Userland/Libraries/LibProtocol/WebSocket.cpp @@ -27,9 +27,7 @@ void WebSocket::send(ByteBuffer binary_or_text_message, bool is_text) void WebSocket::send(StringView text_message) { - auto data_result = ByteBuffer::copy(text_message.bytes()); - VERIFY(data_result.has_value()); - send(data_result.release_value(), true); + send(ByteBuffer::copy(text_message.bytes()).release_value_but_fixme_should_propagate_errors(), true); } void WebSocket::close(u16 code, String reason) |