Skip to content

Commit 2a6399b

Browse files
committed
Tracked to appendFile
1 parent ec5d0bc commit 2a6399b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cardano-testnet/src/Testnet/Runtime.hs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import Testnet.Types (TestnetNode (..), TestnetRuntime (configurationF
6060
import Hedgehog.Extras.Stock.IO.Network.Sprocket (Sprocket (..))
6161
import qualified Hedgehog.Extras.Stock.IO.Network.Sprocket as H
6262
import qualified Hedgehog.Extras.Test.Concurrent as H
63+
import RIO.Directory (doesFileExist)
6364

6465
data NodeStartFailure
6566
= ProcessRelatedFailure ProcessError
@@ -343,8 +344,11 @@ startLedgerNewEpochStateLogging testnetRuntime tmpWorkspace = withFrozenCallStac
343344
-- | Handle all sync exceptions and log them into the log file. We don't want to fail the test just
344345
-- because logging has failed.
345346
handleException = handle $ \(e :: SomeException) -> do
346-
liftIOAnnotated $ appendFile outputFp $ "Ledger new epoch logging failed - caught exception:\n"
347-
<> displayException e <> "\n"
347+
exists <- doesFileExist outputFp
348+
if exists
349+
then liftIOAnnotated $ appendFile outputFp $ "Ledger new epoch logging failed - caught exception:\n"
350+
<> displayException e <> "\n"
351+
else error $ "File does not exist: " <> outputFp
348352
pure ConditionMet
349353

350354
calculateEpochStateDiff

0 commit comments

Comments
 (0)