Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ArabicaCliento/Patches/ClientAdminManagerPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@ private static bool Prefix(ref bool __result)
__result = true;
return false;
}


[HarmonyFinalizer]
private static void Finalizer(Exception __exception)
{
MarseyLogger.Fatal($"Error while patching ClientAdminManagerPatch: {__exception}");
Comment on lines +28 to +31
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Finalizer logs exceptions but does not rethrow.

Suppressing exceptions in the finalizer may conceal errors. Consider rethrowing after logging if needed.

}
}
6 changes: 6 additions & 0 deletions ArabicaCliento/Patches/ClientConGroupControllerPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@ private static bool Prefix(ref bool __result)
__result = true;
return false;
}

[HarmonyFinalizer]
private static void Finalizer(Exception __exception)
{
MarseyLogger.Fatal($"Error while patching ClientConGroupControllerPatch: {__exception}");
}
}
8 changes: 7 additions & 1 deletion ArabicaCliento/Patches/ClientHeavyAttackPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace ArabicaCliento.Patches;

[HarmonyPatch(typeof(MeleeWeaponSystem), "ClientHeavyAttack")]
public class ClientHeavyAttackPatch
internal class ClientHeavyAttackPatch
{
private static IEntityManager? _entMan;
private static TransformSystem? _transform;
Expand All @@ -30,4 +30,10 @@ private static void Prefix(ref EntityUid user,
if (output == null) return;
coordinates = _transform.ToCoordinates(coordinates.EntityId, output.Value.Position);
}

[HarmonyFinalizer]
private static void Finalizer(Exception __exception)
{
MarseyLogger.Fatal($"Error while patching ClientHeavyAttackPatch: {__exception}");
}
}
17 changes: 8 additions & 9 deletions ArabicaCliento/Patches/ConsoleHostPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@

namespace ArabicaCliento.Patches;

[HarmonyPatch]
[HarmonyPatch("Robust.Client.Console.ClientConsoleHost", "CanExecute")]
internal class ConsoleHostPatch
{
[HarmonyTargetMethod]
private static MethodBase TargetMethod()
{
return AccessTools.Method(AccessTools.TypeByName("Robust.Client.Console.ClientConsoleHost"),
"CanExecute");

}

[HarmonyPostfix]
private static void Postfix(ref bool __result) => __result = true;


[HarmonyFinalizer]
private static void Finalizer(Exception __exception)
{
MarseyLogger.Fatal($"Error while patching ConsoleHostPatch: {__exception}");
Comment on lines +13 to +16
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Finalizer logs all exceptions, which may mask original errors.

Logging without rethrowing may suppress important exceptions and hide bugs. Consider rethrowing after logging or handling only specific exceptions.

}
}
8 changes: 7 additions & 1 deletion ArabicaCliento/Patches/DrawOcclusionDepthPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ namespace ArabicaCliento.Patches;
internal static class DrawOcclusionDepthPatch
{
[HarmonyPrefix]
static bool Prefix()
private static bool Prefix()
{
return !ArabicaConfig.FOVDisable;
}

[HarmonyFinalizer]
private static void Finalizer(Exception __exception)
{
MarseyLogger.Fatal($"Error while patching DrawOcclusionDepthPatch: {__exception}");
Comment on lines +14 to +17
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Finalizer logs exceptions but does not handle or rethrow them.

Consider rethrowing the exception after logging to prevent silent failures and ensure errors are not masked.

}
}
7 changes: 7 additions & 0 deletions ArabicaCliento/Patches/EntityMenuElementPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@ namespace ArabicaCliento.Patches;
internal class EntityMenuElementPatch
{
private static MethodInfo? _methodCache;

[HarmonyPrefix]
private static bool Prefix(EntityUid entity, EntityMenuElement __instance, ref string __result)
{
_methodCache ??= AccessTools.Method(typeof(EntityMenuElement), "GetEntityDescriptionAdmin");
__result = _methodCache.Invoke(__instance, [entity]) as string ?? throw new InvalidOperationException();
return false;
}

[HarmonyFinalizer]
private static void Finalizer(Exception __exception)
{
MarseyLogger.Fatal($"Error while patching EntityMenuElementPatch: {__exception}");
}
}
8 changes: 7 additions & 1 deletion ArabicaCliento/Patches/GunUpdatePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace ArabicaCliento.Patches;

[HarmonyPatch(typeof(GunSystem), nameof(GunSystem.Update))]
public class GunUpdatePatch
internal class GunUpdatePatch
{
private static EntityManager? _entMan;
private static IInputManager? _input;
Expand Down Expand Up @@ -57,4 +57,10 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi

return codes.AsEnumerable();
}

[HarmonyFinalizer]
private static void Finalizer(Exception __exception)
{
MarseyLogger.Fatal($"Error while patching GunUpdatePatch: {__exception}");
Comment on lines +61 to +64
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Finalizer logs exceptions but does not rethrow.

Evaluate if rethrowing exceptions after logging is necessary to ensure important errors are not silently ignored.

}
}
6 changes: 6 additions & 0 deletions ArabicaCliento/Patches/MouseRotatorPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ internal class MouseRotatorPatch
{
[HarmonyPrefix]
private static bool Prefix() => false;

[HarmonyFinalizer]
private static void Finalizer(Exception __exception)
{
MarseyLogger.Fatal($"Error while patching MouseRotatorPatch: {__exception}");
}
}
6 changes: 6 additions & 0 deletions ArabicaCliento/Patches/OverlaysPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@ private static bool Prefix()
{
return !ArabicaConfig.OverlaysDisable;
}

[HarmonyFinalizer]
private static void Finalizer(Exception __exception)
{
MarseyLogger.Fatal($"Error while patching OverlaysPatch: {__exception}");
}
}