Skip to content

Commit

Permalink
added logging for dropped RPCs and more detailed RPC fail exception l…
Browse files Browse the repository at this point in the history
…ogging
  • Loading branch information
RugbugRedfern committed Apr 12, 2024
1 parent 04e4947 commit 0b45bc8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion MyceliumNetworkingForCW/MyceliumNetwork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,9 @@ static void HandleMessage(Message message, CSteamID sender)
{
var handlers = GetMessageHandlers(message.ModID, message.MethodName);


bool handled = false;

foreach(var messageHandler in handlers)
{
if(messageHandler.Mask == message.Mask)
Expand All @@ -609,8 +612,15 @@ static void HandleMessage(Message message, CSteamID sender)
}

messageHandler.Method.Invoke(messageHandler.Target, msgParams);

handled = true;
}
}

if(!handled)
{
RugLogger.LogWarning($"Dropped RPC because no registered RPCs were found matching {message.ModID}: {message.MethodName}");
}
}
catch(Exception ex)
{
Expand All @@ -625,7 +635,7 @@ static void HandleMessage(Message message, CSteamID sender)
destination = destinationEx.Message;
}

RugLogger.LogError($"Error executing RPC from {(sender == SteamUser.GetSteamID() ? "local loopback" : sender.ToString())} ({destination}):\n{ex.InnerException} {ex.StackTrace}");
RugLogger.LogError($"Error executing RPC from {(sender == SteamUser.GetSteamID() ? "local loopback" : sender.ToString())} ({destination}):\n{ex.InnerException}\nFull exception:\n{ex} {ex.StackTrace}");
}
}

Expand Down

0 comments on commit 0b45bc8

Please sign in to comment.