Skip to content

Commit

Permalink
Merge pull request #80 from akhmerov/master
Browse files Browse the repository at this point in the history
more informative error message on execution timeout
  • Loading branch information
takluyver committed Aug 2, 2015
2 parents 2220c0f + 107cb6d commit 94254f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion nbconvert/preprocessors/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,12 @@ def run_cell(self, cell):
self.km.interrupt_kernel()
break
else:
raise
try:
exception = TimeoutError
except NameError:
exception = RuntimeError
raise exception("Cell execution timed out, see log"
" for details.")

if msg['parent_header'].get('msg_id') == msg_id:
if msg['metadata']['status'] == 'error' and not self.allow_errors:
Expand Down
7 changes: 6 additions & 1 deletion nbconvert/preprocessors/tests/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ def test_timeout(self):
filename = os.path.join(current_dir, 'files', 'Interrupt.ipynb')
res = self.build_resources()
res['metadata']['path'] = os.path.dirname(filename)
assert_raises(Empty, self.run_notebook, filename, dict(timeout=1), res)
try:
exception = TimeoutError
except NameError:
exception = RuntimeError

assert_raises(exception, self.run_notebook, filename, dict(timeout=1), res)

def test_allow_errors(self):
"""
Expand Down

0 comments on commit 94254f2

Please sign in to comment.