public static ParameterValidationException ParameterValidationFormat(this HarshLoggerError logger, Parameter parameter, String format, params Object[] args) { if (logger == null) { throw Logger.Fatal.ArgumentNull(nameof(logger)); } if (parameter == null) { throw Logger.Fatal.ArgumentNull(nameof(parameter)); } return logger.Write( LogEventLevel.Error, new ParameterValidationException( parameter.Name, HarshLoggerWrapper.FormatCurrentCulture(format, args) ) ); }
protected internal abstract void Validate(Parameter parameter, Object value);
private ImmutableDictionary<String, ParameterSet> RemoveCandidateIfParamDefault( ImmutableDictionary<String, ParameterSet> candidates, Parameter parameter ) { if (parameter.IsCommonParameter) { Logger.Debug( "Skipping common parameter {Parameter}", parameter.Name ); return candidates; } if (parameter.HasDefaultValue(Target)) { Logger.Debug( "Parameter {Parameter} has default value, removing {ParameterSetName} from candidates", parameter.Name, parameter.ParameterSetName ); return candidates.Remove( parameter.ParameterSetName ); } Logger.Debug( "Parameter {Parameter} has a value set, keeping {ParameterSetName} as a candidate", parameter.Name, parameter.ParameterSetName ); return candidates; }