Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

Log an End Turn refusal (ArgumentException) as a warning

eyalgolandb29a243e2d7
diff --git a/unity/Assets/Scripts/UI/SimBridge.cs b/unity/Assets/Scripts/UI/SimBridge.cs
index ed5976acb..ea823e889 100644
--- a/unity/Assets/Scripts/UI/SimBridge.cs
+++ b/unity/Assets/Scripts/UI/SimBridge.cs
@@ -117,7 +117,9 @@ namespace Statecraft.Game.UI
try { r = step(Session, batch); }
catch (Exception e) // any exception (M3 final review M7): never leave a queue that fails on every End Turn
{
- if (!(e is ArgumentException)) UnityEngine.Debug.LogException(e); // unexpected: the full exception for the log
+ // A refusal (ArgumentException) is a clear warning, anything else the full exception: both leave a trace.
+ if (e is ArgumentException) UnityEngine.Debug.LogWarning("End Turn refused: " + e.Message);
+ else UnityEngine.Debug.LogException(e);
queue.Clear();
var reason = text.Format("order.failed", e.Message);
var failed = new StepResult(State, new Cause[0], batch.Select(x => new Rejection(x, reason)).ToList());
diff --git a/unity/Assets/Tests/EditMode/HudTests.cs b/unity/Assets/Tests/EditMode/HudTests.cs
index 30d6ef514..f22e74c76 100644
--- a/unity/Assets/Tests/EditMode/HudTests.cs
+++ b/unity/Assets/Tests/EditMode/HudTests.cs
@@ -261,7 +261,9 @@ public class HudTests
public void ABatchTheSimRefusesOutrightKeepsTheStateAndShowsTheReason(System.Type kind)
{
using var ui = new UiTestKit();
- if (kind != typeof(System.ArgumentException)) LogAssert.Expect(LogType.Exception, new System.Text.RegularExpressions.Regex("boom"));
+ // Every kind leaves a console trace (rereview): a refusal as a warning, anything else as the full exception.
+ if (kind == typeof(System.ArgumentException)) LogAssert.Expect(LogType.Warning, new System.Text.RegularExpressions.Regex("End Turn refused.*boom"));
+ else LogAssert.Expect(LogType.Exception, new System.Text.RegularExpressions.Regex("boom"));
var bridge = new SimBridge(GameSession.New(C, GoldenRun.Seed, Mode.Historical), Text,
(s, cmds) => throw (System.Exception)System.Activator.CreateInstance(kind, "boom")!);
new ToastPresenter(ui.Root, bridge, Text);