mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:47:45 +00:00
Everywhere: Split Error::from_string_literal and Error::from_string_view
Error::from_string_literal now takes direct char const*s, while Error::from_string_view does what Error::from_string_literal used to do: taking StringViews. This change will remove the need to insert `sv` after error strings when returning string literal errors once StringView(char const*) is removed. No functional changes.
This commit is contained in:
parent
c70f45ff44
commit
e5f09ea170
51 changed files with 282 additions and 261 deletions
|
@ -30,7 +30,7 @@ ErrorOr<void> ConnectionBase::post_message(MessageBuffer buffer)
|
|||
// NOTE: If this connection is being shut down, but has not yet been destroyed,
|
||||
// the socket will be closed. Don't try to send more messages.
|
||||
if (!m_socket->is_open())
|
||||
return Error::from_string_literal("Trying to post_message during IPC shutdown"sv);
|
||||
return Error::from_string_literal("Trying to post_message during IPC shutdown");
|
||||
|
||||
// Prepend the message size.
|
||||
uint32_t message_size = buffer.data.size();
|
||||
|
@ -57,9 +57,9 @@ ErrorOr<void> ConnectionBase::post_message(MessageBuffer buffer)
|
|||
shutdown_with_error(error);
|
||||
switch (error.code()) {
|
||||
case EPIPE:
|
||||
return Error::from_string_literal("IPC::Connection::post_message: Disconnected from peer"sv);
|
||||
return Error::from_string_literal("IPC::Connection::post_message: Disconnected from peer");
|
||||
case EAGAIN:
|
||||
return Error::from_string_literal("IPC::Connection::post_message: Peer buffer overflowed"sv);
|
||||
return Error::from_string_literal("IPC::Connection::post_message: Peer buffer overflowed");
|
||||
default:
|
||||
return Error::from_syscall("IPC::Connection::post_message write"sv, -error.code());
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ ErrorOr<Vector<u8>> ConnectionBase::read_as_much_as_possible_from_socket_without
|
|||
deferred_invoke([this] { shutdown(); });
|
||||
if (!bytes.is_empty())
|
||||
break;
|
||||
return Error::from_string_literal("IPC connection EOF"sv);
|
||||
return Error::from_string_literal("IPC connection EOF");
|
||||
}
|
||||
|
||||
bytes.append(bytes_read.data(), bytes_read.size());
|
||||
|
@ -169,7 +169,7 @@ ErrorOr<void> ConnectionBase::drain_messages_from_peer()
|
|||
auto remaining_bytes = TRY(ByteBuffer::copy(bytes.span().slice(index)));
|
||||
if (!m_unprocessed_bytes.is_empty()) {
|
||||
shutdown();
|
||||
return Error::from_string_literal("drain_messages_from_peer: Already have unprocessed bytes"sv);
|
||||
return Error::from_string_literal("drain_messages_from_peer: Already have unprocessed bytes");
|
||||
}
|
||||
m_unprocessed_bytes = move(remaining_bytes);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue