Skip to content

Commit 64470a0

Browse files
committed
Wrapping issue tracker calls with try except after grouping
1 parent bf771e9 commit 64470a0

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

src/clusterfuzz/_internal/cron/triage.py

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ def main():
347347

348348
throttler = Throttler()
349349

350+
return_code = True
351+
350352
for testcase_id in data_handler.get_open_testcase_id_iterator():
351353
logs.info(f'Triaging {testcase_id}')
352354
try:
@@ -428,19 +430,31 @@ def main():
428430
issue_filer.notify_issue_update(testcase, 'new')
429431
continue
430432

431-
# If there are similar issues to this test case already filed or recently
432-
# closed, skip filing a duplicate bug.
433-
if _check_and_update_similar_bug(testcase, issue_tracker):
434-
logs.info(f'Skipping testcase {testcase_id}, since a similar bug'
435-
' was already filed.')
433+
try:
434+
# If there are similar issues to this test case already filed or recently
435+
# closed, skip filing a duplicate bug.
436+
if _check_and_update_similar_bug(testcase, issue_tracker):
437+
logs.info(f'Skipping testcase {testcase_id}, since a similar bug'
438+
' was already filed.')
439+
continue
440+
except Exception as e:
441+
logs.error(f'Failed to check testcase {testcase.id.key()}'
442+
f' for similar bugs: {e}')
443+
return_code = False
436444
continue
437445

438446
# Clean up old triage messages that would be not applicable now.
439447
testcase.delete_metadata(TRIAGE_MESSAGE_KEY, update_testcase=False)
440448

441-
# # File the bug first and then create filed bug metadata.
442-
if not _file_issue(testcase, issue_tracker, throttler):
443-
logs.info(f'Issue filing failed for testcase id {testcase_id}')
449+
try:
450+
# # File the bug first and then create filed bug metadata.
451+
if not _file_issue(testcase, issue_tracker, throttler):
452+
logs.info(f'Issue filing failed for testcase id {testcase_id}')
453+
continue
454+
except Exception as e:
455+
logs.error('Failed to file issue for testcase '
456+
f'{testcase.id.key()}: {e}')
457+
return_code = False
444458
continue
445459

446460
_create_filed_bug_metadata(testcase)
@@ -449,8 +463,12 @@ def main():
449463
logs.info('Filed new issue %s for testcase %d.' % (testcase.bug_information,
450464
testcase_id))
451465

452-
logs.info('Triage testcases succeeded.')
453-
return True
466+
if return_code:
467+
logs.info('Triage testcases succeeded.')
468+
else:
469+
logs.error('Triage testcases failed.')
470+
471+
return return_code
454472

455473

456474
class Throttler:

0 commit comments

Comments
 (0)