Skip to content

Commit 36e113e

Browse files
mmuletrebornix
authored andcommitted
Fixed Issue 78731 (microsoft#78732)
* Fixed Issue 78731 The error handler for OpenLinkOccurrence handled the case of 'invalid' or 'message', but the function returns an error of new Error('invalid') or new Error('missing') instead of 'invalid' or 'missing'. This causes the editor to throw an unhandled exception instead of a warning message. This fix checks for an err.message as well as err for 'invalid' or 'missing'
1 parent 0270232 commit 36e113e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/vs/editor/contrib/links/links.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,12 @@ class LinkDetector implements editorCommon.IEditorContribution {
299299
return this.openerService.open(uri, { openToSide });
300300

301301
}, err => {
302+
const messageOrError =
303+
err instanceof Error ? (<Error>err).message : err;
302304
// different error cases
303-
if (err === 'invalid') {
305+
if (messageOrError === 'invalid') {
304306
this.notificationService.warn(nls.localize('invalid.url', 'Failed to open this link because it is not well-formed: {0}', link.url!.toString()));
305-
} else if (err === 'missing') {
307+
} else if (messageOrError === 'missing') {
306308
this.notificationService.warn(nls.localize('missing.url', 'Failed to open this link because its target is missing.'));
307309
} else {
308310
onUnexpectedError(err);

0 commit comments

Comments
 (0)