From c67a82da3aebe7cf002a493296d978bfc05546c3 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 12 Aug 2020 09:45:39 +0200 Subject: [PATCH] throw TypeError when creating diagnostic without range or without message, fixes https://github.com/microsoft/vscode/issues/99410 --- src/vs/workbench/api/common/extHostTypes.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index 9dc828a248f..4ba62a170c5 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -885,6 +885,12 @@ export class Diagnostic { tags?: DiagnosticTag[]; constructor(range: Range, message: string, severity: DiagnosticSeverity = DiagnosticSeverity.Error) { + if (!Range.isRange(range)) { + throw new TypeError('range must be set'); + } + if (!message) { + throw new TypeError('message must be set'); + } this.range = range; this.message = message; this.severity = severity;