-
Notifications
You must be signed in to change notification settings - Fork 28.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
window.showQuickPick is not closed when promise is rejected #693
Comments
I fixed most of the issues: If there is an error in your promise, the picker will hide and you have a chance to handle the error from the returned promise from the pick() call. @jrieken is our proxy from main to PH not handling errors? I have the following extension that shows a pick with error but in the console I still get an error about unhandled promise: export function activate(context: vscode.ExtensionContext) {
var disposable = vscode.commands.registerCommand('extension.sayHello', () => {
vscode.window.showQuickPick(new Promise((c, e) => {
setTimeout(() => {
e(new Error("does not work"));
}, 2000);
})).then(null, (e) => {
vscode.window.showErrorMessage(e.toString());
});
});
context.subscriptions.push(disposable);
} |
Thanks for the quick fix! |
@bpasero The reject works as expected but there is an known issue with unhandled promise rejection. Our handler sits here: https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/node/pluginHostProcess.ts#L33 but there is a well known issue with that. Since project rejection and handling can happen async (on different event loop ticks) a promise might be handled some time in the future. Since the node events seem to lack the actual promise causing this we can't have better logging. |
@jrieken in the example code I gave, we have a valid use of our API and the console ends up to report unknown errors: I would think this can happen from any promise that carries an error from the main side to the PH side. If we know this can happen and cannot fix it, we should filter these messages. |
It's not possible with the version of nodejs we are using today. Please read the comment and the links I have pointed to. |
And since this only happens when the event loop is released between rejection and handling of it I think its the better compromise to see some potential false positive here and there then not seeing any unhandled rejection. |
tracking the false positive in unhandled rejection here #963 |
👍 |
When
showQuickPick
is used with a promise, it shows a nice progress bar which is cool. But when the promise is rejected, it should close the quick pick in my opinion, which is not the case at the moment, the progress bar just keeps spinning.// @bpasero
The text was updated successfully, but these errors were encountered: