Skip to content

Commit

Permalink
Handle cell execution cancellation because cell is disposed.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongrout committed Nov 22, 2019
1 parent 3755447 commit 970fba0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 3 additions & 2 deletions packages/cells/src/widget.ts
Expand Up @@ -1108,8 +1108,9 @@ export namespace CodeCell {
}
return msg;
} catch (e) {
// If this is still the current execution, clear the prompt.
if (e.message === 'Canceled' && cell.outputArea.future === future) {
// If we started executing, and the cell is still indicating this
// execution, clear the prompt.
if (future && !cell.isDisposed && cell.outputArea.future === future) {
cell.setPrompt('');
}
throw e;
Expand Down
7 changes: 3 additions & 4 deletions packages/notebook/src/actions.tsx
Expand Up @@ -1555,11 +1555,10 @@ namespace Private {
}
})
.catch(reason => {
if (reason.message !== 'Canceled') {
throw reason;
if (cell.isDisposed || reason.message.startsWith('Canceled')) {
return false;
}

return false;
throw reason;
})
.then(ran => {
if (ran) {
Expand Down

0 comments on commit 970fba0

Please sign in to comment.