Skip to content

Commit cd4804e

Browse files
karolbalinusg
authored andcommitted
LibWeb: Use fallible version of StringBuilder::to_byte_buffer
1 parent f8e94f2 commit cd4804e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Userland/Libraries/LibWeb/WebDriver/Client.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ ErrorOr<void, Client::WrappedError> Client::on_ready_to_read()
220220
break;
221221
}
222222

223-
m_request = HTTP::HttpRequest::from_raw_request(builder.to_byte_buffer());
223+
m_request = HTTP::HttpRequest::from_raw_request(TRY(builder.try_to_byte_buffer()));
224224
if (!m_request.has_value())
225225
return {};
226226

@@ -278,7 +278,7 @@ ErrorOr<void, Client::WrappedError> Client::send_success_response(JsonValue resu
278278
builder.appendff("Content-Length: {}\r\n", content.length());
279279
builder.append("\r\n"sv);
280280

281-
auto builder_contents = builder.to_byte_buffer();
281+
auto builder_contents = TRY(builder.try_to_byte_buffer());
282282
TRY(m_socket->write(builder_contents));
283283

284284
while (!content.is_empty()) {
@@ -319,8 +319,8 @@ ErrorOr<void, Client::WrappedError> Client::send_error_response(Error const& err
319319
header_builder.appendff("Content-Length: {}\r\n", content_builder.length());
320320
header_builder.append("\r\n"sv);
321321

322-
TRY(m_socket->write(header_builder.to_byte_buffer()));
323-
TRY(m_socket->write(content_builder.to_byte_buffer()));
322+
TRY(m_socket->write(TRY(header_builder.try_to_byte_buffer())));
323+
TRY(m_socket->write(TRY(content_builder.try_to_byte_buffer())));
324324

325325
log_response(error.http_status);
326326
return {};

0 commit comments

Comments
 (0)