本文整理汇总了C#中PluginProfileErrorCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# PluginProfileErrorCollection.Add方法的具体用法?C# PluginProfileErrorCollection.Add怎么用?C# PluginProfileErrorCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginProfileErrorCollection
的用法示例。
在下文中一共展示了PluginProfileErrorCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleConnectionError
public void HandleConnectionError(Exception exception, PluginProfileErrorCollection errors)
{
_log.GetLogger("Mercurial").Warn("Check connection failed", exception);
exception = exception.InnerException ?? exception;
const string uriFieldName = "Uri";
if (exception is MercurialExecutionException)
{
errors.Add(new PluginProfileError { FieldName = "Login", Message = ExtractValidErrorMessage(exception)});
errors.Add(new PluginProfileError { FieldName = "Password", Message = ExtractValidErrorMessage(exception) });
errors.Add(new PluginProfileError { FieldName = uriFieldName, Message = ExtractValidErrorMessage(exception) });
return;
}
if (exception is ArgumentNullException || exception is DirectoryNotFoundException)
{
errors.Add(new PluginProfileError{ FieldName = uriFieldName, Message = INVALID_URI_OR_INSUFFICIENT_ACCESS_RIGHTS_ERROR_MESSAGE });
}
if (exception is MercurialMissingException)
{
errors.Add(new PluginProfileError { Message = MERCURIAL_IS_NOT_INSTALLED_ERROR_MESSAGE });
}
var fieldName = string.Empty;
if (exception is InvalidRevisionException)
{
fieldName = "Revision";
}
errors.Add(new PluginProfileError {FieldName = fieldName, Message = exception.Message});
}
开发者ID:TargetProcess,项目名称:Target-Process-Plugins,代码行数:31,代码来源:MercurialCheckConnectionErrorResolver.cs
示例2: HandleConnectionError
public void HandleConnectionError(Exception exception, PluginProfileErrorCollection errors)
{
_log.GetLogger("Tfs").Warn("Check connection failed", exception);
exception = exception.InnerException ?? exception;
const string uriFieldName = "Uri";
if (exception is TeamFoundationServiceException)
{
errors.Add(new PluginProfileError { FieldName = "Login", Message = exception.Message });
errors.Add(new PluginProfileError { FieldName = "Password", Message = exception.Message });
errors.Add(new PluginProfileError { FieldName = uriFieldName, Message = exception.Message });
return;
}
if (exception is ArgumentNullException || exception is DirectoryNotFoundException)
{
errors.Add(new PluginProfileError { FieldName = uriFieldName, Message = INVALID_URI_OR_INSUFFICIENT_ACCESS_RIGHTS_ERROR_MESSAGE });
}
var fieldName = string.Empty;
if (exception is InvalidRevisionException)
{
fieldName = "Revision";
}
errors.Add(new PluginProfileError { FieldName = fieldName, Message = exception.Message });
}
示例3: HandleConnectionError
public void HandleConnectionError(Exception exception, PluginProfileErrorCollection errors)
{
_log.GetLogger("Git").Warn("Check connection failed", exception);
exception = exception.InnerException ?? exception;
const string uriFieldName = "Uri";
if (exception is TransportException)
{
errors.Add(new PluginProfileError {FieldName = "Login", Message = exception.Message});
errors.Add(new PluginProfileError {FieldName = "Password", Message = exception.Message});
errors.Add(new PluginProfileError {FieldName = uriFieldName, Message = exception.Message});
return;
}
if (exception is ArgumentNullException)
{
errors.Add(new PluginProfileError{FieldName = uriFieldName, Message = INVALID_URI_OR_INSUFFICIENT_ACCESS_RIGHTS_ERROR_MESSAGE});
}
var fieldName = string.Empty;
if (exception is JGitInternalException)
{
if (exception.Message.ToLower().Contains("invalid remote") || exception.Message.ToLower().Contains("uri"))
{
fieldName = uriFieldName;
}
}
if (exception is InvalidRevisionException)
{
fieldName = "Revision";
}
errors.Add(new PluginProfileError {FieldName = fieldName, Message = exception.Message});
}
示例4: HandleConnectionError
private static void HandleConnectionError(SvnException e, PluginProfileErrorCollection errors)
{
if (e is SvnAuthorizationException)
{
errors.Add(ErrorFor(ConnectionSettings.LoginField, "Authorization failed"));
errors.Add(ErrorFor(ConnectionSettings.PasswordField));
}
else if (e is SvnAuthenticationException || e.RootCause is SvnAuthenticationException)
{
errors.Add(ErrorFor(ConnectionSettings.LoginField, "Authentication failed"));
errors.Add(ErrorFor(ConnectionSettings.PasswordField));
}
else if (e.Message.Contains("200 OK"))
{
errors.Add(ErrorFor(ConnectionSettings.UriField, "Invalid path to repository"));
}
else if (e is SvnRepositoryIOException)
{
errors.Add(ErrorFor(ConnectionSettings.UriField, "Could not connect to server"));
}
else if (e is SvnFileSystemException || e is SvnClientUnrelatedResourcesException)
{
errors.Add(ErrorFor(SubversionPluginProfile.StartRevisionField));
}
else
{
errors.Add(ErrorFor(ConnectionSettings.UriField, e.Message.Fmt("Connection failed. {0}")));
}
}
示例5: ValidateCommand
private void ValidateCommand(PluginProfileErrorCollection errors)
{
if(CommandName.IsNullOrWhitespace())
{
errors.Add(new PluginProfileError { FieldName = "CommandName", Message = "Command name shoud not be empty" });
}
}
示例6: ValidateTasksList
private void ValidateTasksList(PluginProfileErrorCollection errors)
{
if(TasksList.IsNullOrWhitespace())
{
errors.Add(new PluginProfileError { FieldName = "TasksList", Message = "Task list shoud not be empty" });
}
}
示例7: ValidateNameIsNotEmpty
private void ValidateNameIsNotEmpty(PluginProfileErrorCollection errors)
{
if (_dto.Name.IsNullOrWhitespace())
{
errors.Add(new PluginProfileError {FieldName = "Name", Message = "Profile Name is required"});
}
}
示例8: ValidatePassword
private void ValidatePassword(PluginProfileErrorCollection errors)
{
if (Password.IsNullOrWhitespace())
{
errors.Add(new PluginProfileError { FieldName = "Password", Message = "Password should not be empty" });
}
}
示例9: ValidateAuthTokenUserId
private void ValidateAuthTokenUserId(PluginProfileErrorCollection errors)
{
if (AuthTokenUserId <= 0)
{
errors.Add(new PluginProfileError { FieldName = "AuthTokenUserId", Message = "User for authentication should be specified" });
}
}
示例10: ValidateProject
private void ValidateProject(PluginProfileErrorCollection errors)
{
if (Project <= 0)
{
errors.Add(new PluginProfileError { FieldName = "Project", Message = "Project should be specified" });
}
}
示例11: Add
private static PluginProfileErrorCollection Add(PluginProfileErrorCollection errors, Exception e)
{
errors.Add(new PluginProfileError
{
Message = e.Message
});
return errors;
}
示例12: ValidateUniqueness
private void ValidateUniqueness(PluginProfileDto pluginProfile, PluginProfileErrorCollection errors)
{
if (
ProfileCollection.Any(
x => string.Equals(x.Name.Value, pluginProfile.Name, StringComparison.InvariantCultureIgnoreCase)))
{
errors.Add(new PluginProfileError {FieldName = "Name", Message = "Profile name should be unique for plugin"});
}
}
示例13: ValidateNameContainsOnlyValidChars
protected void ValidateNameContainsOnlyValidChars(PluginProfileErrorCollection errors)
{
if (!ProfileDtoValidator.IsValid(Name))
errors.Add(new PluginProfileError
{
FieldName = NameField,
Message = "You can only use letters, numbers, space and underscore symbol in Mashup name"
});
}
示例14: ValidateNameNotEmpty
protected void ValidateNameNotEmpty(PluginProfileErrorCollection errors)
{
if (string.IsNullOrWhiteSpace(Name))
errors.Add(new PluginProfileError
{
FieldName = NameField,
Message = "Mashup name cannot be empty or consist of whitespace characters only"
});
}
示例15: ValidateNameNotEmpty
protected void ValidateNameNotEmpty(PluginProfileErrorCollection errors)
{
if (string.IsNullOrEmpty(Name))
errors.Add(new PluginProfileError
{
FieldName = NameField,
Message = "Mashup name should be specified"
});
}