Repository navigation
fix: partial write error handling - #318
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
There are confirmed correctness/quality issues in the updated error-message formatting logic and test setup (notably null content-type handling and a misleading integration test name) that should be fixed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR tightens how v3 write (/api/v3/write_lp) “partial write” responses are detected and surfaced, aiming to throw InfluxDBPartialWriteException only when the response matches the expected partial-write shape and the client accepts partial writes, while improving error-message formatting and expanding unit/integration coverage.
Changes:
- Classify partial-write errors based on HTTP status, endpoint path,
accept_partial, and JSON shape (data array), rather than string-matching error text. - Improve formatting for v3 error responses that include
data.error_message/line_number/original_line. - Update and expand tests to cover structured vs unstructured partial write behavior and message formatting.
File summaries
| File | Description |
|---|---|
| Client/Internal/RestClient.cs | Refines partial-write detection and error parsing/formatting for v3 write errors. |
| Client.Test/Internal/RestClientTest.cs | Updates existing assertions and adds parameterized coverage for partial-write classification and formatting. |
| Client.Test.Integration/WriteTest.cs | Adjusts integration expectations around AcceptPartial=false behavior. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ef35a08 to
5640ef6
Compare
bdc986f to
a204845
Compare
karel-rehor
left a comment
There was a problem hiding this comment.
Comparison with the similar changes in GO is OK. Where in GO I see <Tokens>Error here we have <Tokens>Exception where the preceding tokens reflect the same naming.
I see that Go wraps the logic starting on line 84 of RestClient.cs into a method classifyWriteError(err,options). I might suggest a similar method here
internal Exception ClassifyException(result, queryParams) {
// logic from current block
}
...
if(!result.IsSuccessStatusCode)
{
throw ClassifyException(result, queryParams)
}However since this code is all internal and not public facing, this is just a suggestion.
Still we should probably clean up warnings about possible derefrencing of possible null arguments.
Further review TBC.
34a3b71 to
268c6dc
Compare
|
Hi @karel-rehor |
karel-rehor
left a comment
There was a problem hiding this comment.
Just one small quibble about name of a self-descriptive local variable, which required some extra time for understanding the block where it is declared.
karel-rehor
left a comment
There was a problem hiding this comment.
Tests pass locally.
Looks good to me. 🚴 🏁
ba6d1f9 to
255a338
Compare
255a338 to
c8cb4e5
Compare


Closes #
Proposed Changes
Changes
- Error response status code is
400.- Error response format
{"error":"...","data":[{"error_message":"...","line_number":2,"original_line": "..."}]}is returned withdatamust be an array.-
accept_partialis set totrue.- Write endpoint must be
api/v3/write_lp.Checklist