Fix liftToIntegration exception handling and rename

未关闭
#6,567 4 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 2 天内回复

@palas 已经在做这个了。

开始于 2026年5月8日。

评估

这个 Issue 还没有评估数据。

描述

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 https://github.com/IntersectMBO/cardano-node/pull/6346 (unresolved comments by @carbolymer), revisited in https://github.com/IntersectMBO/cardano-node/pull/6559#discussion_r3200025726.

主要语言
Haskell
星标
3.2k
派生
763
平均合并
3 天 2 小时
30 天内合并 PR
22

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

IntersectMBO/cardano-node 的其他 Issue

查看 IntersectMBO/cardano-node 的全部 Issue

相似的 Issue

更多 Haskell Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。