本文整理汇总了C#中ErrorCategory类的典型用法代码示例。如果您正苦于以下问题:C# ErrorCategory类的具体用法?C# ErrorCategory怎么用?C# ErrorCategory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ErrorCategory类属于命名空间,在下文中一共展示了ErrorCategory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RuntimeException
internal RuntimeException(string message, string errorId, ErrorCategory category, object target)
: base(message, null)
{
Id = errorId;
Category = category;
TargetObject = target;
}
示例2: CreateErrorRecord
/// <summary>
///
/// </summary>
/// <param name="fullyQualifiedErrorId"></param>
/// <param name="errorCategory"></param>
/// <param name="innerException"></param>
/// <param name="resourceId"></param>
/// <param name="resourceParms"></param>
/// <returns></returns>
internal static ErrorRecord CreateErrorRecord(
string fullyQualifiedErrorId,
ErrorCategory errorCategory,
Exception innerException,
string resourceId,
params object[] resourceParms)
{
InvalidOperationException invalidOperationException;
string errorMessage = string.Format(
CultureInfo.CurrentCulture,
resourceId,
resourceParms);
if (innerException != null)
{
invalidOperationException = new InvalidOperationException(errorMessage, innerException);
}
else
{
invalidOperationException = new InvalidOperationException(errorMessage);
}
ErrorRecord errorRecord = new ErrorRecord(
invalidOperationException,
fullyQualifiedErrorId,
errorCategory,
null);
return errorRecord;
}
示例3: UpdatableHelpSystemException
/// <summary>
/// Class constructor
/// </summary>
/// <param name="errorId">FullyQualifiedErrorId</param>
/// <param name="message">exception message</param>
/// <param name="cat">category</param>
/// <param name="targetObject">target object</param>
/// <param name="innerException">inner exception</param>
internal UpdatableHelpSystemException(string errorId, string message, ErrorCategory cat, object targetObject, Exception innerException)
: base(message, innerException)
{
FullyQualifiedErrorId = errorId;
ErrorCategory = cat;
TargetObject = targetObject;
}
示例4: SetUpException
public static void SetUpException(ref Exception exception, string errorCode, ErrorCategory errorCategory,
object target)
{
exception.Data[ERROR_CODE] = errorCode;
exception.Data[ERROR_CATEGORY] = errorCategory;
exception.Data[ERROR_TARGET] = target;
}
示例5: PSInvalidOperationException
internal PSInvalidOperationException(string message, string id, ErrorCategory errorCategory,
Exception innerException, bool terminating = true)
: base(message, innerException)
{
Terminating = terminating;
ErrorRecord = new ErrorRecord(this, id, errorCategory, null);
}
示例6: SessionStateException
protected SessionStateException(SerializationInfo info, StreamingContext context) : base(info, context)
{
this._itemName = string.Empty;
this._errorId = "SessionStateException";
this._errorCategory = ErrorCategory.InvalidArgument;
this._sessionStateCategory = (System.Management.Automation.SessionStateCategory) info.GetInt32("SessionStateCategory");
}
示例7: DisplayErrors
//public EventHandler<NavigationRequestedEventArgs> NavigationRequested { get; set; }
private void DisplayErrors(ErrorCategory category)
{
lvErrors.Items.Clear();
if (errors == null)
return;
int errorCount = 0, warningCount = 0, messageCount = 0;
foreach (Error error in errors)
{
if ((error.Category & category) != 0)
{
ListViewItem item = new ListViewItem();
item.Text = error.Location.ToString();
item.SubItems.Add(error.Message);
item.Tag = error;
lvErrors.Items.Add(item);
}
switch (error.Category)
{
case ErrorCategory.Error: errorCount++; break;
case ErrorCategory.Warning: warningCount++; break;
case ErrorCategory.Message: messageCount++; break;
}
}
btnErrors.Text = errorCount + " Errors";
btnWarnings.Text = warningCount + " Warnings";
btnMessages.Text = messageCount + " Messages";
btnErrors.Enabled = (errorCount > 0);
btnWarnings.Enabled = (warningCount > 0);
btnMessages.Enabled = (messageCount > 0);
}
示例8: ErrorRecord
public ErrorRecord(Exception exception, string errorId, ErrorCategory errorCategory, object targetObject)
{
Exception = exception;
ErrorId = errorId;
TargetObject = targetObject;
CategoryInfo = new ErrorCategoryInfo(exception, errorCategory);
}
示例9: ErrorCategoryInfo
internal ErrorCategoryInfo(Exception exception, ErrorCategory category)
{
this.Category = category;
this.Activity = string.Empty;
this.Reason = exception.GetType().Name;
this.TargetName = string.Empty;
this.TargetType = string.Empty;
}
示例10: CommandNotFoundException
internal CommandNotFoundException(string commandName, Exception innerException, string errorIdAndResourceId, string resourceStr, params object[] messageArgs) : base(BuildMessage(commandName, errorIdAndResourceId, resourceStr, messageArgs), innerException)
{
this.commandName = string.Empty;
this._errorId = "CommandNotFoundException";
this._errorCategory = ErrorCategory.ObjectNotFound;
this.commandName = commandName;
this._errorId = errorIdAndResourceId;
}
示例11: ThrowError
/// <summary>
/// Throws a terminating error.
/// </summary>
/// <param name="targetObject">Object which caused this exception.</param>
/// <param name="errorId">ErrorId for this error.</param>
/// <param name="innerException">Complete exception object.</param>
/// <param name="category">ErrorCategory for this exception.</param>
internal void ThrowError(
Object targetObject,
string errorId,
Exception innerException,
ErrorCategory category)
{
ThrowTerminatingError(new ErrorRecord(innerException, errorId, category, targetObject));
}
示例12: OrchardProviderException
/// <summary>
/// Initializes a new instance of the <see cref="OrchardProviderException"/> class.
/// </summary>
/// <param name="message">The exception's message.</param>
/// <param name="fatal">if set to <c>true</c> indicates that the error is fatal.</param>
/// <param name="errorId">The error identifier.</param>
/// <param name="category">The error category.</param>
public OrchardProviderException(
string message,
bool fatal,
string errorId,
ErrorCategory category = ErrorCategory.NotSpecified)
: base(message, fatal, errorId, category)
{
}
示例13: ReportableException
public ReportableException(string message, Exception innerException, ErrorCategory category,
string errorId, object targetObject)
: base(message, innerException)
{
_category = category;
_errorId = errorId;
_targetObject = targetObject;
}
示例14: ParameterBindingValidationException
internal ParameterBindingValidationException(Exception innerException, ErrorCategory errorCategory, InvocationInfo invocationInfo, IScriptExtent errorPosition, string parameterName, Type parameterType, Type typeSpecified, string resourceBaseName, string errorIdAndResourceId, params object[] args) : base(innerException, errorCategory, invocationInfo, errorPosition, parameterName, parameterType, typeSpecified, resourceBaseName, errorIdAndResourceId, args)
{
ValidationMetadataException exception = innerException as ValidationMetadataException;
if ((exception != null) && exception.SwallowException)
{
this._swallowException = true;
}
}
示例15: PSInvalidOperationException
internal PSInvalidOperationException(string message, Exception innerException, string errorId, ErrorCategory errorCategory, object target) : base(message, innerException)
{
this._errorId = "InvalidOperation";
this._errorCategory = ErrorCategory.InvalidOperation;
this._errorId = errorId;
this._errorCategory = errorCategory;
this._target = target;
}