ITADN

Fix liftToIntegration exception handling and rename

#6567Openpalas 创建于 2026-05-08
Stale
P
palascommented
## Problem `liftToIntegration` in `cardano-testnet/src/Testnet/Start/Cardano.hs:104` has two issues: ### 1. Duplicate exception messages The current exception handler chain: ```haskell 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`: ```haskell 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 https://github.com/IntersectMBO/cardano-node/pull/6346 (unresolved comments by @carbolymer), revisited in https://github.com/IntersectMBO/cardano-node/pull/6559#discussion_r3200025726.
2 条评论