Skip to content

Commit c2502cd

Browse files
authored
fix: generate simulation report regardless of success or failure (#63)
1 parent c09767f commit c2502cd

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

src/ViewModels/SimulateViewModel.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,24 @@ async Task StartSimulation()
9898
if (result.Success)
9999
{
100100
Status = _loc.T("Sim.Completed", result.Elapsed.TotalSeconds);
101-
L($"Result: {(result.Success ? "PASS" : "FAIL")}");
102-
foreach (var note in result.Notes) L($" Note: {note}");
103-
var reportPath = await _report.GenerateAsync(Config, result, Config.OutputDirectory);
104-
L(_loc.T("Sim.Report", reportPath));
105101
}
106-
else { Status = _loc.T("Sim.Failed", result.ErrorMessage ?? "unknown"); }
102+
else
103+
{
104+
Status = _loc.T("Sim.Failed", result.ErrorMessage ?? "unknown");
105+
}
106+
L($"Result: {(result.Success ? "PASS" : "FAIL")}");
107+
foreach (var note in result.Notes) L($" Note: {note}");
108+
var reportPath = await _report.GenerateAsync(Config, result, Config.OutputDirectory);
109+
L(_loc.T("Sim.Report", reportPath));
110+
}
111+
catch (Exception ex)
112+
{
113+
Status = $"Error: {ex.Message}";
114+
L($"FATAL: {ex}");
115+
var failResult = new SimulationResult { Success = false, ErrorMessage = ex.Message };
116+
var reportPath = await _report.GenerateAsync(Config, failResult, Config.OutputDirectory);
117+
L(_loc.T("Sim.Report", reportPath));
107118
}
108-
catch (Exception ex) { Status = $"Error: {ex.Message}"; L($"FATAL: {ex}"); }
109119
finally { IsRunning = false; }
110120
}
111121

0 commit comments

Comments
 (0)