Skip to content

Commit 20a7376

Browse files
committed
Proposed fix
1 parent 8f27471 commit 20a7376

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cardano-testnet/src/Testnet/Runtime.hs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,16 @@ startLedgerNewEpochStateLogging testnetRuntime tmpWorkspace = withFrozenCallStac
333333
-- | Handle all sync exceptions and log them into the log file. We don't want to fail the test just
334334
-- because logging has failed.
335335
handleException = handle $ \(e :: SomeException) -> do
336-
liftIOAnnotated $ appendFile outputFp $ "Ledger new epoch logging failed - caught exception:\n"
336+
exists <- liftIO $ IO.doesFileExist outputFp
337+
if exists
338+
then liftIOAnnotated $ appendFile outputFp $ "Ledger new epoch logging failed - caught exception:\n"
339+
<> displayException e <> "\n"
340+
else
341+
liftIO $ writeFile outputFp $ unlines
342+
["Ledger new epoch logging failed - caught exception:"
343+
, displayException e
344+
]
345+
liftIO $ appendFile outputFp $ "Ledger new epoch logging failed - caught exception:\n"
337346
<> displayException e <> "\n"
338347
pure ConditionMet
339348

0 commit comments

Comments
 (0)