1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:27:45 +00:00

IPCCompiler+LibIPC: Propagate IPC encoder errors

This propagates errors from user-defined encoders up to IPC::Connection.
There, we currently just log the error, as we aren't in a position to
propagate it further (i.e. we are inside a deferred invocation).
This commit is contained in:
Timothy Flynn 2023-01-01 23:58:49 -05:00 committed by Andreas Kling
parent ab99ed5fba
commit 8b7b03b369
4 changed files with 22 additions and 16 deletions

View file

@ -49,7 +49,7 @@ Core::Stream::LocalSocket& ConnectionBase::fd_passing_socket()
ErrorOr<void> ConnectionBase::post_message(Message const& message)
{
return post_message(message.encode());
return post_message(TRY(message.encode()));
}
ErrorOr<void> ConnectionBase::post_message(MessageBuffer buffer)
@ -129,9 +129,15 @@ void ConnectionBase::handle_messages()
auto messages = move(m_unprocessed_messages);
for (auto& message : messages) {
if (message.endpoint_magic() == m_local_endpoint_magic) {
if (auto response = m_local_stub.handle(message)) {
if (auto result = post_message(*response); result.is_error()) {
dbgln("IPC::ConnectionBase::handle_messages: {}", result.error());
auto handler_result = m_local_stub.handle(message);
if (handler_result.is_error()) {
dbgln("IPC::ConnectionBase::handle_messages: {}", handler_result.error());
continue;
}
if (auto response = handler_result.release_value()) {
if (auto post_result = post_message(*response); post_result.is_error()) {
dbgln("IPC::ConnectionBase::handle_messages: {}", post_result.error());
}
}
}