Skip to content

Commit

Permalink
Fix error messages when creating new dirs/files in a read only dir (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
vkaidalov-rft committed Jul 19, 2021
1 parent 3523819 commit 7c228f1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 2 additions & 0 deletions packages/filebrowser/src/browser.ts
Expand Up @@ -276,6 +276,7 @@ export class FileBrowser extends Widget {
this._directoryPending = false;
})
.catch(err => {
void showErrorMessage(this._trans.__('Error'), err);
this._directoryPending = false;
});
}
Expand Down Expand Up @@ -305,6 +306,7 @@ export class FileBrowser extends Widget {
this._filePending = false;
})
.catch(err => {
void showErrorMessage(this._trans.__('Error'), err);
this._filePending = false;
});
}
Expand Down
10 changes: 6 additions & 4 deletions packages/fileeditor-extension/src/commands.ts
Expand Up @@ -936,10 +936,12 @@ export namespace Commands {
ext
})
.then(model => {
return commands.execute('docmanager:open', {
path: model.path,
factory: FACTORY
});
if (model != undefined) {
return commands.execute('docmanager:open', {
path: model.path,
factory: FACTORY
});
}
});
}

Expand Down
12 changes: 7 additions & 5 deletions packages/notebook-extension/src/index.ts
Expand Up @@ -1205,11 +1205,13 @@ function activateNotebookHandler(
return commands
.execute('docmanager:new-untitled', { path: cwd, type: 'notebook' })
.then(model => {
return commands.execute('docmanager:open', {
path: model.path,
factory: FACTORY,
kernel: { name: kernelName }
});
if (model != undefined) {
return commands.execute('docmanager:open', {
path: model.path,
factory: FACTORY,
kernel: { name: kernelName }
});
}
});
};

Expand Down

0 comments on commit 7c228f1

Please sign in to comment.