throw TypeError when creating diagnostic without range or without message, fixes https://github.com/microsoft/vscode/issues/99410

This commit is contained in:
Johannes Rieken
2020-08-12 09:45:39 +02:00
parent c17b4c2488
commit c67a82da3a

View File

@@ -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;