Propagate DB errors in CategoryFilter.Get - #1076
Conversation
CategoryFilter.Get dropped the error from finder.Find and returned an empty result with a nil error, so a real query failure surfaced as an empty category list reported as success. Every sibling filter (ModelFilter, ConnectionFilter) returns the error instead. Return nil, 0, 0, err to match them. Fixes meshery#1075 Signed-off-by: Atishyy27 <sethatishayjain@gmail.com>
|
Yay, your first pull request! 👍 A contributor will be by to give feedback soon. In the meantime, you can find updates in the #github-notifications channel in the community Slack. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesCategory filter error handling
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Fixes #1075.
What
CategoryFilter.Getdropped the error fromfinder.Findand returned an empty result with a nil error:So a real query failure (e.g. a bad
OrderOncolumn from a caller-supplied sort param → SQL error, or a transient DB error) surfaced as an empty category list reported as success — nothing returned to the client, nothing logged.Change
Return
nil, 0, 0, err, matching every sibling filter —ModelFilter.GetandConnectionFilter.Getboth already propagate the error this way.CategoryFilterwas the only outlier.Testing
One-line change;
GOOS=linux go build ./models/meshmodel/registry/...andgo vetboth pass. Behaviour for the success path is unchanged.Summary by CodeRabbit