Skip to content

Commit 1b56339

Browse files
committed
Final fix
1 parent 50e850c commit 1b56339

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cardano-testnet/src/Testnet/Runtime.hs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,15 @@ startLedgerNewEpochStateLogging testnetRuntime tmpWorkspace = withFrozenCallStac
343343
-- | Handle all sync exceptions and log them into the log file. We don't want to fail the test just
344344
-- because logging has failed.
345345
handleException = handle $ \(e :: SomeException) -> do
346-
liftIOAnnotated $ appendFile outputFp $ "Ledger new epoch logging failed - caught exception:\n"
347-
<> displayException e <> "\n"
346+
exists <- liftIO $ IO.doesFileExist outputFp
347+
if exists
348+
then liftIOAnnotated $ appendFile outputFp $ "Ledger new epoch logging failed - caught exception:\n"
349+
<> displayException e <> "\n"
350+
else do
351+
liftIO $ writeFile outputFp $ unlines
352+
["Ledger new epoch logging failed - caught exception:"
353+
, displayException e
354+
]
348355
pure ConditionMet
349356

350357
calculateEpochStateDiff

0 commit comments

Comments
 (0)