diff --git a/RequestLib/ModNetwork.cs b/RequestLib/ModNetwork.cs index f52c05d..983f006 100644 --- a/RequestLib/ModNetwork.cs +++ b/RequestLib/ModNetwork.cs @@ -277,7 +277,12 @@ private static void OnResponse(string senderGuid, string possibleResponseGuid, b var pendingRequestGuid = responseGuid.ToString(GuidFormat); if (PendingRequests.Remove(pendingRequestGuid, out var request)) { var response = new API.Response(accepted ? API.RequestResult.Accepted : API.RequestResult.Declined, responseMetadata); - request.OnResponse?.Invoke(request, response); + try { + request.OnResponse?.Invoke(request, response); + } + catch (Exception e) { + MelonLogger.Error($"The response handler function has errored. This is a problem with the mod {request.ModName}", e); + } } } @@ -354,9 +359,10 @@ private static void OnMessage(object _, MessageReceivedEventArgs e) { break; } } - catch (Exception) { + catch (Exception ex) { MelonLogger.Warning($"Received a malformed message from {CVRPlayerManager.Instance.TryGetPlayerName(senderGuid)}, " + $"they might be running an outdated version of the mod, or I broke something, or they're trying to do something funny."); + MelonLogger.Error(ex); } } diff --git a/RequestLib/Properties/AssemblyInfo.cs b/RequestLib/Properties/AssemblyInfo.cs index 89aad0f..7da57ef 100644 --- a/RequestLib/Properties/AssemblyInfo.cs +++ b/RequestLib/Properties/AssemblyInfo.cs @@ -29,7 +29,7 @@ namespace Kafe.RequestLib.Properties; internal static class AssemblyInfoParams { - public const string Version = "0.0.12"; + public const string Version = "0.0.13"; public const string Author = "kafeijao"; public const string BTKUILibName = "BTKUILib"; public const string BTKSAImmersiveHudName = "BTKSAImmersiveHud"; diff --git a/RequestLib/Properties/CVRMG.json b/RequestLib/Properties/CVRMG.json index d8b8068..f285432 100644 --- a/RequestLib/Properties/CVRMG.json +++ b/RequestLib/Properties/CVRMG.json @@ -1,7 +1,7 @@ { "_id": 169, "name": "RequestLib", - "modversion": "0.0.12", + "modversion": "0.0.13", "gameversion": "2024r175", "loaderversion": "v0.6.1", "modtype": "Mod", @@ -14,6 +14,6 @@ "requirements": ["[BTKUILib](https://api.cvrmg.com/v1/mods/download/113)"], "downloadlink": "https://github.com/kafeijao/Kafe_CVR_Mods/releases/download/r68/RequestLib.dll", "sourcelink": "https://github.com/kafeijao/Kafe_CVR_Mods/tree/master/RequestLib", - "changelog": "- Added a listener on the receiver of the request when the response is about to get sent. This is useful when you want to do something with the request result (since auto-accept/decline exist you wouldn't be able to intercept those without this)", + "changelog": "- Added better error logging", "embedcolor": "16C60C" }