mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 17:02:51 +08:00
(GH-226) Switch ParameterValidationAttribute check to IsNullOrWhiteSpace
* fixes #226
This commit is contained in:
parent
35568ab823
commit
a3e11b24e5
@ -33,9 +33,9 @@ namespace Spectre.Console.Cli.Internal
|
|||||||
{
|
{
|
||||||
// If there is a error message specified in the parameter validator attribute,
|
// If there is a error message specified in the parameter validator attribute,
|
||||||
// then use that one, otherwise use the validation result.
|
// then use that one, otherwise use the validation result.
|
||||||
var result = validator.ErrorMessage != null
|
var result = string.IsNullOrWhiteSpace(validator.ErrorMessage)
|
||||||
? ValidationResult.Error(validator.ErrorMessage)
|
? validationResult
|
||||||
: validationResult;
|
: ValidationResult.Error(validator.ErrorMessage);
|
||||||
|
|
||||||
throw CommandRuntimeException.ValidationFailed(result);
|
throw CommandRuntimeException.ValidationFailed(result);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user