Dedup error message in init --update without --preset path#198
Dedup error message in init --update without --preset path#198taiman724 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the error handling in pkg/commands/init.go by returning the error from readChartYamlPreset directly instead of wrapping it with a redundant message. A lint suppression comment was added to explain that the original error already contains the necessary context. I have no feedback to provide as there were no review comments.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR removes redundant error message wrapping in the ChangesError handling improvement
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fixes cozystack#179: the error path in updateTalmLibraryChart wrapped the inner error from readChartYamlPreset with a redundant outer message, producing a colon-joined double statement. The inner error already carries a full message and hint. Remove the outer wrap so the error is emitted once. Signed-off-by: Shunta Hayashi <201278530+taiman724@users.noreply.github.com>
9488a45 to
7064ddd
Compare
Summary
Fixes #179: when running alm init --update without --preset and without a preset dependency in Chart.yaml, the error path emitted the same message twice via a redundant outer errors.Wrap:
preset is required: use --preset flag or ensure Chart.yaml has a preset dependency: preset not found in Chart.yaml dependenciesThe inner error from
eadChartYamlPreset (pkg/commands/init.go:767-770) already carries a complete message (preset not found in Chart.yaml dependencies) and a hint directing the user to add the dependency or pass --preset. The outer wrap in updateTalmLibraryChart at line 1168 layered a second full sentence on top, producing the colon-joined double.
Change
olint:wrapcheck comment since the inner error is already at the user-facing boundary).
After this fix, the same scenario emits only the inner error once:
preset not found in Chart.yaml dependencies hint: add a preset chart (e.g. cozystack) to Chart.yaml's dependencies, or pass --preset on the command lineTests
Existing tests in pkg/commands/contract_chart_gitignore_test.go assert that
eadChartYamlPreset returns an error containing preset not found — that contract is preserved unchanged. Ran go test ./pkg/commands/... confirms no regressions (Go not available in this environment; code change is a one-line mechanical removal verified by inspection).
Closes #179.
Prepared with AI assistance (Claude Sonnet 4.6 via Claude Code).
Summary by CodeRabbit