Fix Elastic adapter when attempting to generate notes for non-ApiError exceptions#230
Fix Elastic adapter when attempting to generate notes for non-ApiError exceptions#230JSCU-CNI wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #230 +/- ##
==========================================
- Coverage 84.29% 84.27% -0.02%
==========================================
Files 35 35
Lines 3756 3758 +2
==========================================
+ Hits 3166 3167 +1
- Misses 590 591 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
yunzheng
left a comment
There was a problem hiding this comment.
Hmm it looks like create_elasticsearch_error_notes only considered BulkIndexError, where .errors is a list of Dicts:
And it seems TransportError also has .errors but is a tuple of Exception:
| # The stack of errors could include different exceptions, such as TransportErrors. | ||
| if not hasattr(error, "get"): | ||
| continue | ||
|
|
There was a problem hiding this comment.
Hmm it looks like create_elasticsearch_error_notes only considered BulkIndexError, where .errors is a list of Dicts:
And it seems TransportError also has .errors but is a tuple of Exception:
I think instead of skipping we should consider it being a dictionary or an Exception (and update the typing), then in the loop we can still add the error as a note:
notes = []
for idx, error in enumerate(errors, 1):
if isinstance(error, Exception):
# Create formatted Exception note
note_parts = [
f"Error {idx}, {error}",
]
elif isinstance(error, dict):
# Extract index information
....
notes.append("\n".join(note_parts) + "\n")
No description provided.