Skip to content

Commit

Permalink
[import-document] added error log to track bug
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyCloarec authored Jun 6, 2024
1 parent 14216f4 commit e415eff
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions internal-import-file/import-document/src/reportimporter/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,20 @@ def _process_parsing_results(
)
if len(entity_stix_bundle["objects"]) == 0:
raise ValueError("Entity cannot be found or exported")

entity_stix = [
object
for object in entity_stix_bundle["objects"]
if object["id"] == match[RESULT_FORMAT_MATCH]
][0]
entities.append(entity_stix)
]
if len(entity_stix) == 0:
log_message = "Couldn't find entity {} bundle {}".format(
match, entity_stix_bundle
)
self.helper.log_error(log_message)
raise ValueError("Entity cannot be found in bundle")

entities.append(entity_stix[0])
else:
self.helper.log_info("Odd data received: {}".format(match))

Expand Down

0 comments on commit e415eff

Please sign in to comment.