Microsoft/vscode

errors thrown by openerService.resolveExternalUri not surfaced to MainThreadWindow.$asExternalUri in VS Code Web

Open

#162 770 ouverte le 5 oct. 2022

Voir sur GitHub
 (4 commentaires) (0 réactions) (1 assigné)TypeScript (10 221 forks)batch import
bughelp wantedopener

Métriques du dépôt

Stars
 (74 848 stars)
Métriques de merge PR
 (Merge moyen 11h 43m) (1 000 PRs mergées en 30 j)

Description

  • VS Code Version: 1.72.1 (main)
  • OS Version: N/A
  • Browser: Chrome

Steps to Reproduce:

  1. git clone https://github.com/microsoft/vscode.git
  2. run VS Code Web locally
  3. install any extension that uses asExternalUri (i.e. this one)
  4. run command "Hello World"
  5. 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?

Guide contributeur