Skip to content

Commit 48c46a4

Browse files
authored
Merge pull request #1552 from chrisfilo/enh/fail_sentry_fingerprint
ENH: Group all 'finished running with errors' sentry messages
2 parents e11fd31 + 328c7c6 commit 48c46a4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

fmriprep/viz/reports.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,13 @@ def generate_reports(subject_list, output_dir, work_dir, run_uuid, sentry_sdk=No
354354
logger = logging.getLogger('cli')
355355
error_list = ', '.join('%s (%d)' % (subid, err)
356356
for subid, err in zip(subject_list, report_errors) if err)
357-
logger.error('Preprocessing did not finish successfully. Errors occurred while processing '
358-
'data from participants: %s. Check the HTML reports for details.' %
359-
error_list)
357+
358+
err_msg = 'Preprocessing did not finish successfully. Errors occurred while processing ' \
359+
'data from participants: %s. Check the HTML reports for details.' % error_list
360+
if sentry_sdk:
361+
with sentry_sdk.push_scope() as scope:
362+
scope.fingerprint = ['fMRIPrep finished with errors']
363+
logger.error(err_msg)
364+
else:
365+
logger.error(err_msg)
360366
return errno

0 commit comments

Comments
 (0)