Use a better error message for #129584

Fixes #129584
This commit is contained in:
Raymond Zhao 2021-07-27 12:48:29 -07:00
parent c35100aba3
commit 2dc0755ede
No known key found for this signature in database
GPG key ID: D36E5FCE46B63B58

View file

@ -60,7 +60,9 @@ export function createValidator(prop: IConfigurationPropertySchema): (value: any
}
if (prop.type === 'string') {
if (!isString(value)) {
if (prop.enum && !isStringArray(prop.enum)) {
errors.push(nls.localize('validations.stringIncorrectEnumOptions', 'The enum options should be strings, but there is a non-string option. Please file an issue with the extension author.'));
} else if (!isString(value)) {
errors.push(nls.localize('validations.stringIncorrectType', 'Incorrect type. Expected "string".'));
} else {
errors.push(...stringValidations.filter(validator => !validator.isValid(value)).map(validator => validator.message));