Problem
liftToIntegration in cardano-testnet/src/Testnet/Start/Cardano.hs:104 has two issues:
1. Duplicate exception messages
The current exception handler chain:
catch @_ @SomeException (runRIO rMap r) (withFrozenCallStack $ failException . toException . stringException . displayException)
serializes the exception to a string via displayException, then wraps it in a new StringException (which captures its own callstack), then passes that to failException (which calls displayException again). This produces output like:
━━━ Exception (StringException) ━━━
UnliftIO.Exception.throwString called with:
! AnnotatedException !
Underlying exception type: StringException
UnliftIO.Exception.throwString called with:
<actual error message>
Called from: ...
CallStack (from HasCallStack): ...
Called from: ...
The error message and callstack appear twice, and the exception type banners are nested three levels deep.
Fix: replace the chain with just failException, which already accepts SomeException:
catch @_ @SomeException (runRIO rMap r) (withFrozenCallStack failException)
2. Unclear name
liftToIntegration doesn't convey what is being lifted from/to. A name like runRIOInIntegration would be clearer — it runs a RIO ResourceMap action inside Hedgehog's Integration monad.
Context
Originally flagged as tech debt from #6346 (unresolved comments by @carbolymer), revisited in #6559 (comment).
Problem
liftToIntegrationincardano-testnet/src/Testnet/Start/Cardano.hs:104has two issues:1. Duplicate exception messages
The current exception handler chain:
serializes the exception to a string via
displayException, then wraps it in a newStringException(which captures its own callstack), then passes that tofailException(which callsdisplayExceptionagain). This produces output like:The error message and callstack appear twice, and the exception type banners are nested three levels deep.
Fix: replace the chain with just
failException, which already acceptsSomeException:2. Unclear name
liftToIntegrationdoesn't convey what is being lifted from/to. A name likerunRIOInIntegrationwould be clearer — it runs aRIO ResourceMapaction inside Hedgehog'sIntegrationmonad.Context
Originally flagged as tech debt from #6346 (unresolved comments by @carbolymer), revisited in #6559 (comment).