Improve exception handling in Flodesk::Client
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 lib/flodesk.rb 中的 Client#request 开始,检查第 70–74 行附近的返回类型检查。当 response_body 不存在时,验证连接错误路径,更新调用方行为,并运行现有的 Flodesk 相关 specs,以确认会引发错误,且 nil 情况不再导致 NoMethodError。
由索引模型根据 Issue 内容生成。
描述
Currently we've got the following code in Client#request:
Make code nil-safe
This can result in a NoMethodError: undefined method '[]' for nil if there is an issue connecting to Flodesk and the response doesn't actually contain a message_body.
This could happen in production, but also can be a source of flaky tests as happened recently.
Proposing to make this nil-safe by using e.response_body&.['message']
Raise rather than return the exception
Currently this code is actually returning the FlodeskError rather than raising it.
Proposing to raise the exception instead, but note there's one place where we currently check the return type from the method that will need updating to reflect this change:
Mock out the client in tests
As a separate task we can take a look at mocking → Fixed on https://github.com/codebar/planner/pull/2402Flodesk::Client in the specs.
- 主要语言
- Ruby
- 星标
- 105
- 派生
- 206
- 平均合并
- 19 小时 48 分钟
- 30 天内合并 PR
- 83
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codebar/planner 的其他 Issue
-
DashboardQuery eager-loads workshop_host with :sponsors in one join (same host-loss trap as #2975)未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 28/100
codebar/planner#3008 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 18/100
codebar/planner#3006 · 1 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
agent:triaged bug bughunt pm:bundler priority:p1
难度 2/5 1-3 小时 新手友好度 70/100
SocketDev/socket-patch#1573 · 1 条评论 ·
维护者通常 1 天内回复
-
bug chat verified
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 6 天内回复
-
🐞 bug pending triage
难度 2/5 1-3 小时 新手友好度 72/100
CircuitVerse/CircuitVerse#8031 · 2 条评论 ·
维护者通常 1 天内回复
-
BazaRb::Fake#enter rejects dotted badges accepted by BazaRb#enter可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 1/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
riscv/riscv-unified-db#2740 ·
维护者通常 1 天内回复