Skip to content

Commit 0332c65

Browse files
authored
Fix problem with import errors not showing up for the user (microsoft#5185)
For #3958 Root cause was a promise not being waited on to force errors to come out. <!-- If an item below does not apply to you, then go ahead and check it off as "done" and strikethrough the text, e.g.: - [x] ~Has unit tests & system/integration tests~ --> - [x] Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR) - [x] Title summarizes what is changing - [x] Has a [news entry](https://github.com/Microsoft/vscode-python/tree/master/news) file (remember to thank yourself!) - [ ] Has sufficient logging. - [ ] Has telemetry for enhancements. - [ ] Unit tests & system/integration tests are added/updated - [ ] [Test plan](https://github.com/Microsoft/vscode-python/blob/master/.github/test_plan.md) is updated as appropriate - [ ] [`package-lock.json`](https://github.com/Microsoft/vscode-python/blob/master/package-lock.json) has been regenerated by running `npm install` (if dependencies have changed) - [ ] The wiki is updated with any design decisions/details.
1 parent a3103bf commit 0332c65

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

news/2 Fixes/3958.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix problem with errors not showing up for import when no jupyter installed.

package-lock.json

Lines changed: 21 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/client/datascience/history/historycommandlistener.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,11 @@ export class HistoryCommandListener implements IDataScienceCommandListener {
101101
}
102102

103103
// tslint:disable:no-any
104-
private listenForErrors(promise: () => Promise<any>) : Promise<any> {
104+
private async listenForErrors(promise: () => Promise<any>) : Promise<any> {
105+
let result: any;
105106
try {
106-
return promise();
107+
result = await promise();
108+
return result;
107109
} catch (err) {
108110
if (!(err instanceof CancellationError)) {
109111
if (err.message) {
@@ -117,7 +119,7 @@ export class HistoryCommandListener implements IDataScienceCommandListener {
117119
this.logger.logInformation('Canceled');
118120
}
119121
}
120-
return Promise.resolve();
122+
return result;
121123
}
122124

123125
private showInformationMessage(message: string, question?: string) : Thenable<string | undefined> {

0 commit comments

Comments
 (0)