Ver Fonte

Backport PR #10641: Fix error messages when creating new dirs/files in a read only dir (#10646)

Co-authored-by: Vadym Kaidalov <79568556+vkaidalov-rft@users.noreply.github.com>
MeeseeksMachine há 3 anos atrás
pai
commit
a31ca4434e

+ 2 - 0
packages/filebrowser/src/browser.ts

@@ -276,6 +276,7 @@ export class FileBrowser extends Widget {
         this._directoryPending = false;
       })
       .catch(err => {
+        void showErrorMessage(this._trans.__('Error'), err);
         this._directoryPending = false;
       });
   }
@@ -305,6 +306,7 @@ export class FileBrowser extends Widget {
         this._filePending = false;
       })
       .catch(err => {
+        void showErrorMessage(this._trans.__('Error'), err);
         this._filePending = false;
       });
   }

+ 6 - 4
packages/fileeditor-extension/src/commands.ts

@@ -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
+          });
+        }
       });
   }
 

+ 7 - 5
packages/notebook-extension/src/index.ts

@@ -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 }
+          });
+        }
       });
   };