浏览代码

Merge pull request #4116 from blink1073/file-loading-error

Handle bad format errors
Ian Rose 7 年之前
父节点
当前提交
cbbd7c9e2b
共有 2 个文件被更改,包括 3 次插入6 次删除
  1. 3 0
      packages/docregistry/src/context.ts
  2. 0 6
      packages/docregistry/src/registry.ts

+ 3 - 0
packages/docregistry/src/context.ts

@@ -340,6 +340,9 @@ class Context<T extends DocumentRegistry.IModel> implements DocumentRegistry.ICo
     }).catch(err => {
       const localPath = this._manager.contents.localPath(this._path);
       const name = PathExt.basename(localPath);
+      if (err.message === 'Invalid response: 400 bad format') {
+        err = new Error('JupyterLab is unable to open this file type.');
+      }
       this._handleError(err, `File Load Error for ${name}`);
       throw err;
     });

+ 0 - 6
packages/docregistry/src/registry.ts

@@ -1123,12 +1123,6 @@ namespace DocumentRegistry {
       mimeTypes: ['text/csv'],
       iconClass: 'jp-MaterialIcon jp-SpreadsheetIcon'
     },
-    {
-      name: 'xls',
-      displayName: 'Spreadsheet',
-      extensions: ['.xls'],
-      iconClass: 'jp-MaterialIcon jp-SpreadsheetIcon'
-    },
     {
       name: 'r',
       displayName: 'R File',