当前位置: 首页>>代码示例>>C#>>正文


C# ErrorCategory类代码示例

本文整理汇总了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;
 }
开发者ID:mauve,项目名称:Pash,代码行数:7,代码来源:RuntimeException.cs

示例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;
        }
开发者ID:PowerShell,项目名称:SmartPackageProvider,代码行数:40,代码来源:DscInvoker.cs

示例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;
 }
开发者ID:dfinke,项目名称:powershell,代码行数:15,代码来源:UpdatableHelpSystem.cs

示例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;
 }
开发者ID:CenturionFox,项目名称:attribute-common,代码行数:7,代码来源:ExceptionHelper.cs

示例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);
 }
开发者ID:mauve,项目名称:Pash,代码行数:7,代码来源:PSInvalidOperationException.cs

示例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");
 }
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:SessionStateException.cs

示例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);
        }
开发者ID:meloscheng,项目名称:dos-debugger,代码行数:34,代码来源:ErrorWindow.cs

示例8: ErrorRecord

 public ErrorRecord(Exception exception, string errorId, ErrorCategory errorCategory, object targetObject)
 {
     Exception = exception;
     ErrorId = errorId;
     TargetObject = targetObject;
     CategoryInfo = new ErrorCategoryInfo(exception, errorCategory);
 }
开发者ID:mauve,项目名称:Pash,代码行数:7,代码来源:ErrorRecord.cs

示例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;
 }
开发者ID:Pash-Project,项目名称:Pash,代码行数:8,代码来源:ErrorCategoryInfo.cs

示例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;
 }
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:CommandNotFoundException.cs

示例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));
 }
开发者ID:dfinke,项目名称:powershell,代码行数:15,代码来源:ConsoleCommands.cs

示例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) 
 {
 }
开发者ID:jean,项目名称:OrchardPs,代码行数:15,代码来源:OrchardProviderException.cs

示例13: ReportableException

 public ReportableException(string message, Exception innerException, ErrorCategory category,
                            string errorId, object targetObject)
     : base(message, innerException)
 {
     _category = category;
     _errorId = errorId;
     _targetObject = targetObject;
 }
开发者ID:sburnicki,项目名称:ODSCmdlets,代码行数:8,代码来源:ReportableException.cs

示例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;
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:ParameterBindingValidationException.cs

示例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;
 }
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:PSInvalidOperationException.cs


注:本文中的ErrorCategory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。