소스 검색

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 3 년 전
부모
커밋
a31ca4434e
3개의 변경된 파일15개의 추가작업 그리고 9개의 파일을 삭제
  1. 2 0
      packages/filebrowser/src/browser.ts
  2. 6 4
      packages/fileeditor-extension/src/commands.ts
  3. 7 5
      packages/notebook-extension/src/index.ts

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