##// END OF EJS Templates
ExecutionResult support `raise_error` method
Tianhui Michael Li -
Show More
@@ -208,6 +208,13 b' class ExecutionResult(object):'
208 def success(self):
208 def success(self):
209 return (self.error_before_exec is None) and (self.error_in_exec is None)
209 return (self.error_before_exec is None) and (self.error_in_exec is None)
210
210
211 def raise_error(self):
212 """Reraises error if `success` is `False`, otherwise does nothing"""
213 if self.error_before_exec is not None:
214 raise self.error_before_exec
215 if self.error_in_exec is not None:
216 raise self.error_in_exec
217
211
218
212 class InteractiveShell(SingletonConfigurable):
219 class InteractiveShell(SingletonConfigurable):
213 """An enhanced, interactive shell for Python."""
220 """An enhanced, interactive shell for Python."""
@@ -2714,11 +2721,8 b' class InteractiveShell(SingletonConfigurable):'
2714 try:
2721 try:
2715 for cell in get_cells():
2722 for cell in get_cells():
2716 result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
2723 result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
2717 if not result.success and raise_exceptions:
2724 if raise_exceptions:
2718 if result.error_before_exec is not None:
2725 result.raise_error()
2719 raise result.error_before_exec
2720 else:
2721 raise result.error_in_exec
2722 elif not result.success:
2726 elif not result.success:
2723 break
2727 break
2724 except:
2728 except:
General Comments 0
You need to be logged in to leave comments. Login now