@@ -387,25 +387,32 @@ def _handle_failure(gd: typing.Dict[str, str]) -> None:
387387
388388 # convert all the notebooks
389389 for notebook_filename in self .notebooks :
390- self .convert_single_notebook (notebook_filename )
390+ try :
391+ self .convert_single_notebook (notebook_filename )
392+
393+ # Exceptions that shouldn't interrupt the entire conversion process should go here
394+ # Those that should go in outer try/except
395+ except UnresponsiveKernelError :
396+ self .log .error (
397+ "While processing assignment %s, the kernel became "
398+ "unresponsive and we could not interrupt it. This probably "
399+ "means that the students' code has an infinite loop that "
400+ "consumes a lot of memory or something similar. nbgrader "
401+ "doesn't know how to deal with this problem, so you will "
402+ "have to manually edit the students' code (for example, to "
403+ "just throw an error rather than enter an infinite loop). " ,
404+ assignment )
405+ errors .append ((gd ['assignment_id' ], gd ['student_id' ]))
406+ _handle_failure (gd )
407+
408+ except Exception as e :
409+ raise e
391410
392411 # set assignment permissions
393412 self .set_permissions (gd ['assignment_id' ], gd ['student_id' ])
394413 self .run_post_convert_hook ()
395414
396- except UnresponsiveKernelError :
397- self .log .error (
398- "While processing assignment %s, the kernel became "
399- "unresponsive and we could not interrupt it. This probably "
400- "means that the students' code has an infinite loop that "
401- "consumes a lot of memory or something similar. nbgrader "
402- "doesn't know how to deal with this problem, so you will "
403- "have to manually edit the students' code (for example, to "
404- "just throw an error rather than enter an infinite loop). " ,
405- assignment )
406- errors .append ((gd ['assignment_id' ], gd ['student_id' ]))
407- _handle_failure (gd )
408-
415+ # Exceptions that should interrupt the entire conversion go here
409416 except sqlalchemy .exc .OperationalError :
410417 _handle_failure (gd )
411418 self .log .error (traceback .format_exc ())
0 commit comments