Skip to content

fix: v3 error response handling#197

Merged
alespour merged 8 commits intomainfrom
fix/error-body-handling
Feb 6, 2026
Merged

fix: v3 error response handling#197
alespour merged 8 commits intomainfrom
fix/error-body-handling

Conversation

@alespour
Copy link
Contributor

@alespour alespour commented Feb 5, 2026

Closes #

Proposed Changes

v3 endpoint error can be a structured JSON. eg. write error:

{
  "error": "partial write of line protocol occurred",
  "data": [
    {
      "error_message": "invalid column type for column 'v', expected iox::column_type::field::integer, got iox::column_type::field::float",
      "line_number": 2,
      "original_line": "testa6a3ad v=1 17702"
    }
  ]
}

This PR fixes handling of such payload and resulting error message is constructed with all the error detail (and is aligned with other client libs like influxdb3-go):

v3 write error message: partial write of line protocol occurred:
	line 2: invalid column type for column 'v', expected iox::column_type::field::integer, got iox::column_type::field::float (testa6a3ad v=1 17702)

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • Tests pass
  • Commit messages are conventional

@alespour alespour changed the title fix: handle extended error response fix: handle v3 write error response Feb 5, 2026
@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.75%. Comparing base (56e2b13) to head (8033217).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #197      +/-   ##
==========================================
+ Coverage   70.37%   70.75%   +0.38%     
==========================================
  Files          35       35              
  Lines        2356     2380      +24     
==========================================
+ Hits         1658     1684      +26     
+ Misses        698      696       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alespour alespour changed the title fix: handle v3 write error response fix: handle v3 error response Feb 5, 2026
@alespour alespour changed the title fix: handle v3 error response fix: handle v3 error responses Feb 5, 2026
@alespour alespour changed the title fix: handle v3 error responses fix: v3 error response handling Feb 5, 2026
@alespour alespour requested a review from Copilot February 5, 2026 13:18
@alespour alespour marked this pull request as ready for review February 5, 2026 13:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances error handling for InfluxDB v3 write operations by parsing and formatting structured JSON error responses that contain detailed line-by-line error information. The implementation aligns with similar functionality in other InfluxDB client libraries like influxdb3-go.

Changes:

  • Added parsing logic for v3 write error responses with detailed error information per line
  • Added status_code attribute to ApiException for compatibility
  • Comprehensive test coverage for various error response formats

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
influxdb_client_3/exceptions/exceptions.py Implements parsing of v3 error format with error and data fields, formatting detailed line-specific errors
influxdb_client_3/write_client/rest.py Adds status_code attribute alias to ApiException for API compatibility
tests/test_api_client.py Adds comprehensive unit tests covering multiple edge cases for v3 error parsing
tests/test_influxdb_client_3_integration.py Adds integration test verifying v3 error handling with real server responses
CHANGELOG.md Documents the bug fix for v3 write error details handling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@bednar bednar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@alespour alespour merged commit 6186d2d into main Feb 6, 2026
16 checks passed
@alespour alespour deleted the fix/error-body-handling branch February 6, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants