Phase 6: Fix swallowed exceptions and cleanup unused usings
- Add debug logging to all empty catch blocks in DecalHarmonyClean.cs setup methods (prefix method catches intentionally stay silent to never break other plugins) - Add error logging to VtankControl.VtSetSetting catch - Add logging to DecalPatchMethods.ProcessInterceptedMessage catch - Remove unused usings from PluginCore.cs (System.Diagnostics, System.Drawing, System.Text, System.Text.RegularExpressions) - Flatten redundant nested try/catch in PatchPluginHost Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0713e96a99
commit
64e690f625
4 changed files with 38 additions and 40 deletions
|
|
@ -62,9 +62,9 @@ namespace MosswartMassacre
|
|||
// PATHWAY 2: Target Host.Actions.AddChatText (what our plugin uses)
|
||||
PatchHostActions();
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Only log if completely unable to apply any patches
|
||||
AddDebugLog($"ApplyDecalPatches failed: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -92,13 +92,15 @@ namespace MosswartMassacre
|
|||
{
|
||||
ApplySinglePatch(method, prefixMethodName);
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddDebugLog($"PatchHooksWrapper single patch failed ({prefixMethodName}): {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddDebugLog($"PatchHooksWrapper failed: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -139,16 +141,18 @@ namespace MosswartMassacre
|
|||
{
|
||||
ApplySinglePatch(method, prefixMethodName);
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddDebugLog($"PatchHostActions single patch failed ({prefixMethodName}): {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
// PATHWAY 3: Try to patch at PluginHost level
|
||||
PatchPluginHost();
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddDebugLog($"PatchHostActions failed: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -157,9 +161,6 @@ namespace MosswartMassacre
|
|||
/// </summary>
|
||||
private static void PatchPluginHost()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Try to patch CoreManager.Current.Actions if it's different
|
||||
try
|
||||
{
|
||||
var coreActions = CoreManager.Current?.Actions;
|
||||
|
|
@ -177,18 +178,16 @@ namespace MosswartMassacre
|
|||
string prefixMethodName = "AddChatTextPrefixCore" + parameters.Length;
|
||||
ApplySinglePatch(method, prefixMethodName);
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddDebugLog($"PatchPluginHost single patch failed: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddDebugLog($"PatchPluginHost failed: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -210,8 +209,9 @@ namespace MosswartMassacre
|
|||
patchesApplied = true;
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddDebugLog($"ApplySinglePatch failed ({prefixMethodName}): {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -244,8 +244,9 @@ namespace MosswartMassacre
|
|||
}
|
||||
patchesApplied = false;
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddDebugLog($"Cleanup failed: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -390,8 +391,9 @@ namespace MosswartMassacre
|
|||
Task.Run(() => WebSocket.SendChatTextAsync(color, text));
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
DecalHarmonyClean.AddDebugLog($"ProcessInterceptedMessage failed: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using Decal.Adapter;
|
||||
|
|
|
|||
|
|
@ -72,9 +72,9 @@ namespace MosswartMassacre
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Swallow any errors and signal failure
|
||||
PluginCore.WriteToChat($"[VTank] SetSetting error ({setting}): {ex.Message}");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue