fix(qdrant): wrap propagated client errors with operation context (#55)#56
Conversation
…ancarloerra#55) The deliberate catch-and-rethrow sites in `loadProjectHashes` and `getCollectionInfo` were re-throwing the raw Qdrant client error. With no wrapping, the original message ("Internal Server Error") landed verbatim in the MCP response and `codebase_status` `lastCompleted.error` field, leaving consumers no way to distinguish which operation failed, which collection it targeted, or whether the underlying error carried an HTTP status code. Add a `wrapQdrantError(operation, context, err)` helper and apply it at both rethrow sites. The new error message looks like: loadProjectHashes(collName=codebase_xxx) failed [status 500]: Internal Server Error The original error is preserved via `cause`, so any consumer that walks the cause chain still has full access. Also pick up `statusCode` as a fallback for clients that use that field name. Behaviour preserved: - 404 / not-found still returns null from `getCollectionInfo` (no change). - Re-throw is still the path for transient/unknown errors (no behaviour change for the deliberate hardening that protects against destructive clean-start cascades). Adds `tests/unit/qdrant-error-wrapping.test.ts` covering the 404 pass- through, wrapped-message format, status-code inclusion, missing-status case, and `cause` preservation. Closes giancarloerra#55.
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR improves error diagnostics from the Qdrant indexer service by introducing structured error wrapping. A new ChangesQdrant Error Wrapping
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 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)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
Summary
Fixes #55. The deliberate catch-and-rethrow sites in
loadProjectHashesandgetCollectionInfowere re-throwing raw Qdrant client errors. With no wrapping, the original message (Internal Server Error) landed verbatim in the MCP response andcodebase_status.lastCompleted.error, leaving consumers no way to distinguish which operation failed, which collection it targeted, or whether the underlying error carried an HTTP status code.Change
Add a small
wrapQdrantError(operation, context, err)helper and apply it at both rethrow sites. The new error message looks like:The original error is preserved via
cause, so any consumer walking the cause chain still has full access. Also picks upstatusCodeas a fallback for clients that use that field name instead ofstatus.Behaviour preserved
nullfromgetCollectionInfo(no change).Tests
tests/unit/qdrant-error-wrapping.test.tswith 6 cases: 404 passthrough, wrapped-message format for both functions, status-code inclusion, missing-status case, andcausepreservation.tsc --noEmitis clean.CLA
I agree to the Contributor License Agreement.
Summary by CodeRabbit
Bug Fixes
Tests