Skip to content

Commit 7e42cf1

Browse files
committed
Fix mime type output to show us what the problem is.
Add some more logging for another problem.
1 parent f45d105 commit 7e42cf1

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

package.nls.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"LanguageService.bannerMessage": "Can you please take 2 minutes to tell us how the Python Language Server is working for you?",
7373
"LanguageService.bannerLabelYes": "Yes, take survey now",
7474
"LanguageService.bannerLabelNo": "No, thanks",
75-
"DataScience.unknownMimeType": "Unknown mime type for data",
75+
"DataScience.unknownMimeTypeFormat": "Mime type {0} is not currently supported.",
7676
"DataScience.historyTitle": "Python Interactive",
7777
"DataScience.badWebPanelFormatString": "<html><body><h1>{0} is not a valid file name</h1></body></html>",
7878
"DataScience.sessionDisposed": "Cannot execute code, session has been disposed.",
@@ -123,7 +123,7 @@
123123
"DataScience.jupyterSelectURIPrompt": "Enter the URI of a Jupyter server",
124124
"DataScience.jupyterSelectURIInvalidURI": "Invalid URI specified",
125125
"DataScience.jupyterNotebookFailure": "Jupyter notebook failed to launch. \r\n{0}",
126-
"DataScience.jupyterNotebookConnectFailed": "Failed to connect to Jupyter notebook. \r\n{0}",
126+
"DataScience.jupyterNotebookConnectFailed": "Failed to connect to Jupyter notebook. \r\n{0}\r\n{1}",
127127
"DataScience.notebookVersionFormat": "Jupyter Notebook Version: {0}",
128128
"DataScience.jupyterKernelNotSupportedOnActive": "Jupyter kernel cannot be started from '{0}'. Using closest match {1} instead.",
129129
"DataScience.jupyterKernelSpecNotFound": "Cannot create a Jupyter kernel spec and none are available for use",

src/client/common/utils/localize.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export namespace DataScience {
4747
export const historyTitle = localize('DataScience.historyTitle', 'Python Interactive');
4848
export const badWebPanelFormatString = localize('DataScience.badWebPanelFormatString', '<html><body><h1>{0} is not a valid file name</h1></body></html>');
4949
export const sessionDisposed = localize('DataScience.sessionDisposed', 'Cannot execute code, session has been disposed.');
50-
export const unknownMimeType = localize('DataScience.unknownMimeType', 'Unknown mime type for data');
50+
export const unknownMimeTypeFormat = localize('DataScience.unknownMimeTypeFormat', 'Mime type {0} is not currently supported');
5151
export const exportDialogTitle = localize('DataScience.exportDialogTitle', 'Export to Jupyter Notebook');
5252
export const exportDialogFilter = localize('DataScience.exportDialogFilter', 'Jupyter Notebooks');
5353
export const exportDialogComplete = localize('DataScience.exportDialogComplete', 'Notebook written to {0}');
@@ -94,7 +94,7 @@ export namespace DataScience {
9494
export const jupyterSelectURIPrompt = localize('DataScience.jupyterSelectURIPrompt', 'Enter the URI of a Jupyter server');
9595
export const jupyterSelectURIInvalidURI = localize('DataScience.jupyterSelectURIInvalidURI', 'Invalid URI specified');
9696
export const jupyterNotebookFailure = localize('DataScience.jupyterNotebookFailure', 'Jupyter notebook failed to launch. \r\n{0}');
97-
export const jupyterNotebookConnectFailed = localize('DataScience.jupyterNotebookConnectFailed', 'Failed to connect to Jupyter notebook. \r\n{0}');
97+
export const jupyterNotebookConnectFailed = localize('DataScience.jupyterNotebookConnectFailed', 'Failed to connect to Jupyter notebook. \r\n{0}\r\n{1}');
9898
export const notebookVersionFormat = localize('DataScience.notebookVersionFormat', 'Jupyter Notebook Version: {0}');
9999
//tslint:disable-next-line:no-multiline-string
100100
export const jupyterKernelNotSupportedOnActive = localize('DataScience.jupyterKernelNotSupportedOnActive', `iPython kernel cannot be started from '{0}'. Using closest match {1} instead.`);

src/client/datascience/jupyter/jupyterExecution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ export class JupyterExecution implements IJupyterExecution, Disposable {
243243
return result;
244244
} catch (err) {
245245
// Something else went wrong
246-
throw new Error(localize.DataScience.jupyterNotebookConnectFailed().format(connection.baseUrl));
246+
throw new Error(localize.DataScience.jupyterNotebookConnectFailed().format(connection.baseUrl, err));
247247
}
248248
}, cancelToken);
249249
}

src/datascience-ui/history-react/cell.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export class Cell extends React.Component<ICellProps> {
5151
}
5252

5353
// Public for testing
54-
public getUnknownMimeTypeString = () => {
55-
return getLocString('DataScience.unknownMimeType', 'Unknown Mime Type');
54+
public getUnknownMimeTypeFormatString = () => {
55+
return getLocString('DataScience.unknownMimeTypeFormat', 'Unknown Mime Type');
5656
}
5757

5858
private toggleInputBlock = () => {
@@ -169,7 +169,7 @@ export class Cell extends React.Component<ICellProps> {
169169
const Transform = transforms[mimetype];
170170

171171
if (typeof mimetype !== 'string') {
172-
return <div key={index}>{this.getUnknownMimeTypeString()}</div>;
172+
return <div key={index}>{this.getUnknownMimeTypeFormatString().format(mimetype)}</div>;
173173
}
174174

175175
try {
@@ -261,7 +261,7 @@ export class Cell extends React.Component<ICellProps> {
261261
return this.renderWithTransform(mimetype, copy, index);
262262
}
263263

264-
const str : string = this.getUnknownMimeTypeString();
264+
const str : string = this.getUnknownMimeTypeFormatString().format(mimetype);
265265
return <div key={index}>${str}</div>;
266266
}
267267
}

src/test/datascience/history.functional.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ for _ in range(50):
454454
// Our cell should have been rendered. It should have a method to get a loc string
455455
const cellFound = wrapper.find('Cell');
456456
const cell = cellFound.at(0).instance() as Cell;
457-
assert.equal(cell.getUnknownMimeTypeString(), 'Unknown mime type from helper', 'Unknown mime type did not come from script');
457+
assert.equal(cell.getUnknownMimeTypeFormatString(), 'Mime type {0} is not currently supported', 'Unknown mime type did not come from script');
458458
});
459459

460460
test('Dispose test', async () => {

0 commit comments

Comments
 (0)