fix: expose error status, headers and body on failed clientBatchCheck items - #381
Conversation
… items The throwable passed to ClientBatchCheckClientResponse is the CompletionException from the check future, so the instanceof FgaError branch never matched and statusCode, headers and rawResponse stayed null, making getStatusCode() throw NullPointerException. Unwrap the wrapper exception before the check. Fixes #380
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe batch-check response constructor now unwraps asynchronous exceptions and safely copies error response metadata. Tests verify status codes, raw bodies, and headers for 400, 404, and 500 errors. ChangesBatch check error metadata
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Failed batch-check items now expose the existing error status, headers, and body instead of leaving them unavailable. No actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The implementation addresses issue ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #381 +/- ##
============================================
+ Coverage 38.73% 38.86% +0.13%
- Complexity 1292 1298 +6
============================================
Files 198 198
Lines 7707 7711 +4
Branches 900 902 +2
============================================
+ Hits 2985 2997 +12
+ Misses 4576 4567 -9
- Partials 146 147 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Fixes failed batch-check items so HTTP error metadata is exposed correctly.
Changes:
- Unwraps asynchronous exception wrappers before detecting
FgaError. - Safely extracts status, headers, and raw response.
- Adds coverage for HTTP 400, 404, and 500 failures.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
ClientBatchCheckClientResponse.java |
Extracts metadata from wrapped errors. |
OpenFgaClientTest.java |
Verifies failed-item HTTP metadata. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Network failures (connection refused, timeout, DNS) exhaust retries and fail with a plain ApiException rather than an FgaError, so statusCode stays null and the primitive getStatusCode() threw the same NullPointerException as issue #380. Return a boxed, null-documented Integer instead of a fake sentinel status, document the null behaviour of getHeaders() and getRawResponse(), and cover the exhausted-retries network-failure path with a WireMock connection-fault test.
|
|
|
@SoulPancake - do you think, we should update in changelog? |
|
@Siddhant-K-code |
The throwable passed to ClientBatchCheckClientResponse is the CompletionException from the check future, so the instanceof FgaError branch never matched and statusCode, headers and rawResponse stayed null, making getStatusCode() throw NullPointerException. Unwrap the wrapper exception before the check.
Fixes #380
Description
What problem is being solved?
How is it being solved?
What changes are made to solve it?
References
Review Checklist
mainSummary by CodeRabbit
Bug Fixes
Tests