fix: issueAfterReset and Grants used together error#3609
Conversation
📝 WalkthroughWalkthroughThis PR updates error handling in the entitlement driver by replacing a plain error return with a properly wrapped generic validation error when conflicting input parameters are detected. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes This is a straightforward error handling improvement affecting a single validation case. The change is localized and follows an established pattern for error wrapping in the codebase. Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
openmeter/entitlement/driver/v2/mapping.go (1)
285-287: Nice fix! Error wrapping looks good.The change correctly wraps the validation error with
models.NewGenericValidationError(), which should help with proper error handling upstream. The error message is clear and accurately describes the conflict.One small thought for consistency: there are a few other validation errors in this function (like line 240:
"input is nil", line 321:"usage period is required...", and line 386:"unknown entitlement type") that might benefit from the same wrapping treatment. Not critical, but could make error handling more consistent across the board.Based on coding guidelines
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
openmeter/entitlement/driver/v2/mapping.go(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go
⚙️ CodeRabbit configuration file
**/*.go: In general when reviewing the Golang code make readability and maintainability a priority, even potentially suggest restructuring the code to improve them.Performance should be a priority in critical code paths. Anything related to event ingestion, message processing, database operations (regardless of database) should be vetted for potential performance bottlenecks.
Files:
openmeter/entitlement/driver/v2/mapping.go
🧬 Code graph analysis (1)
openmeter/entitlement/driver/v2/mapping.go (1)
pkg/models/errors.go (1)
NewGenericValidationError(138-140)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (go)
Overview
Fix missing error wrapping for entitlement error where both
issueAfterResetandgrantsare provided for create inputs.Summary by CodeRabbit