From c30c3d0c34f0e1f84fb9a2b87776c39790035fc0 Mon Sep 17 00:00:00 2001 From: Konrad `ktoso` Malawski Date: Tue, 15 Nov 2022 17:40:33 +0900 Subject: [PATCH] =testkit better error reporting when trying to dump log but capture was disabled --- .../Cluster/ClusteredActorSystemsXCTestCase.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sources/DistributedActorsTestKit/Cluster/ClusteredActorSystemsXCTestCase.swift b/Sources/DistributedActorsTestKit/Cluster/ClusteredActorSystemsXCTestCase.swift index c3abba3ba..d696bc0e1 100644 --- a/Sources/DistributedActorsTestKit/Cluster/ClusteredActorSystemsXCTestCase.swift +++ b/Sources/DistributedActorsTestKit/Cluster/ClusteredActorSystemsXCTestCase.swift @@ -300,7 +300,11 @@ extension ClusteredActorSystemsXCTestCase { } return self.lock.withLock { - self._logCaptures[index] + if _logCaptures.count > index { + return self._logCaptures[index] + } else { + fatalError("Attempt to get logs but no logs captured for index \(index)!") + } } }