Microsoft/vscode
在 GitHub 查看errors thrown by openerService.resolveExternalUri not surfaced to MainThreadWindow.$asExternalUri in VS Code Web
Open
#162,770 创建于 2022年10月5日
bughelp wantedopener
仓库指标
- Star
- (74,848 star)
- PR 合并指标
- (平均合并 11小时 43分钟) (30 天内合并 1,000 个 PR)
描述
- VS Code Version: 1.72.1 (
main) - OS Version: N/A
- Browser: Chrome
Steps to Reproduce:
git clone https://github.com/microsoft/vscode.git- run VS Code Web locally
- install any extension that uses
asExternalUri(i.e. this one) - run command "Hello World"
- Open Browser Console
Expected
Should log error thrown 'Could not resolve external URI: ' + resource.toString()
Actual Nothing
Notes
I believe this happens because there is no try/catch block here:
https://github.com/microsoft/vscode/blob/main/src/vs/workbench/api/browser/mainThreadWindow.ts#L63
When you add a try/catch block there like so:
try {
const result = await this.openerService.resolveExternalUri(URI.revive(uriComponents), options);
return result.resolved;
} catch (e) {
console.error('something wrong', e);
}
const result = await this.openerService.resolveExternalUri(URI.revive(uriComponents), options);
return result.resolved;
Then it logs the thrown error
Screenshot
Would you accept a PR to fix this?