(GH-226) Switch ParameterValidationAttribute check to IsNullOrWhiteSpace

* fixes #226
This commit is contained in:
Mattias Karlsson 2021-01-13 19:22:19 +01:00 committed by Patrik Svensson
parent 35568ab823
commit a3e11b24e5

View File

@ -33,9 +33,9 @@ namespace Spectre.Console.Cli.Internal
{
// If there is a error message specified in the parameter validator attribute,
// then use that one, otherwise use the validation result.
var result = validator.ErrorMessage != null
? ValidationResult.Error(validator.ErrorMessage)
: validationResult;
var result = string.IsNullOrWhiteSpace(validator.ErrorMessage)
? validationResult
: ValidationResult.Error(validator.ErrorMessage);
throw CommandRuntimeException.ValidationFailed(result);
}