Add exception handling for code search job
@@ -128,10 +128,10 @@ class CodeSearchExtract:
self.logger.info("Search request {}".format(prop_file))
code = result['elements'][0]['docData']['code']
+ try:
code_dict = dict(line.split("=", 1) for line in code.strip().splitlines())
- if "database.name" in code_dict:
+
db['database_name'] = code_dict['database.name']
- if "database.type" in code_dict:
db['database_type'] = code_dict['database.type']
owner_record = SCMOwnerRecord(
@@ -145,6 +145,10 @@ class CodeSearchExtract:
)
owner_count += 1
self.code_search_committer_writer.append(owner_record)
+ except Exception as e:
+ self.logger.error(e)
+ self.logger.error("Exception happens with code {}".format(code))
+
self.code_search_committer_writer.close()
self.logger.info('Finish Fetching committers, total {} committers entries'.format(committers_count))
