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


C# Exception.IsFatal方法代码示例

本文整理汇总了C#中System.Exception.IsFatal方法的典型用法代码示例。如果您正苦于以下问题:C# Exception.IsFatal方法的具体用法?C# Exception.IsFatal怎么用?C# Exception.IsFatal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Exception的用法示例。


在下文中一共展示了Exception.IsFatal方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleException

        public bool HandleException(object sender, Exception exception) {
            if (exception.IsFatal())
                return false;

            if (sender is IEventBus)
                return false;

            Logger.Error(exception, "An Unexpected exception was caught");

            //Notifier

            return true;
        }
开发者ID:hsb0307,项目名称:Nut.NET,代码行数:13,代码来源:ExceptionPolicy.cs

示例2: HandleException

        public bool HandleException(object sender, Exception exception)
        {
            if (IsFatal(exception))
            {
                return false;
            }

            if (sender is IEventBus && exception.IsFatal())
            {
                return false;
            }

            Logger.Error(exception, "An unexpected exception was caught");

            do
            {
                RaiseNotification(exception);
                exception = exception.InnerException;
            } while (exception != null);

            return true;
        }
开发者ID:qhme,项目名称:OrchardLite,代码行数:22,代码来源:DefaultExceptionPolicy.cs

示例3: IsLogged

 private static bool IsLogged(Exception ex) {
     return ex is OrchardSecurityException || !ex.IsFatal();
 }
开发者ID:mikmakcar,项目名称:orchard_fork_learning,代码行数:3,代码来源:SessionLocator.cs

示例4: DomainOperationException

        /// <summary>
        /// Private constructor used by all public constructors.
        /// </summary>
        /// <param name="message">The localized error message</param>
        /// <param name="innerException">Optional inner exception.</param>
        /// <param name="status">status of the exception</param>
        /// <param name="errorCode">custom error code</param>
        /// <param name="stackTrace">stack trace of the exception</param>
        /// <param name="validationErrors">validation errror of the exception</param>
        protected DomainOperationException(string message, Exception innerException, OperationErrorStatus status, int errorCode, string stackTrace, IEnumerable<ValidationResult> validationErrors)
            : base(message, innerException)
        {
            Debug.Assert(!innerException.IsFatal(), "Fatal exception passed in as InnerException");

            this._data.Status = status;
            this._data.StackTrace = stackTrace;
            this._data.ErrorCode = errorCode;
            // Iterate the enumerable now in order to capture the validation errors at the moment the exception is created
            if (validationErrors != null)
                this._data.ValidationResults = new ReadOnlyCollection<ValidationResult>(validationErrors.ToList());
            
#if !SILVERLIGHT
            // TODO: uncomment when CLR fixes 851783
            //// The new CLR 4.0 safe serialization model accepts custom data through
            //// this pattern.  We are called back during serialization to provide
            //// our custom data.
            //SerializeObjectState += delegate(object exception, SafeSerializationEventArgs eventArgs)
            //{
            //    eventArgs.AddSerializedState(this._data);
            //};
#endif
        }
开发者ID:kouweizhong,项目名称:openair,代码行数:32,代码来源:DomainOperationException.cs

示例5: AttributeBuilderException

 /// <summary>
 /// Initializes a new instance of the <see cref="AttributeBuilderException"/> class.
 /// </summary>
 /// <param name="innerException">
 /// The <see cref="Exception"/> that was thrown during the attribute building process.
 /// </param>
 /// <param name="attributeType">The type of attribute that caused the exception.</param>
 /// <param name="attributePropertyName">
 /// The name of the property on the <see cref="Attribute"/> that caused the exception.
 /// </param>
 /// <remarks>
 /// The message for this exception represents the code comment error as well as the
 /// prefix for the build warning.
 /// <para>
 /// The message of the <see cref="Exception.InnerException"/> is used for the exception
 /// details.
 /// </para>
 /// </remarks>
 public AttributeBuilderException(Exception innerException, Type attributeType, string attributePropertyName)
     : base(string.Format(CultureInfo.CurrentCulture, Resource.ClientCodeGen_Attribute_ThrewException, attributeType, attributePropertyName), innerException)
 {
     Debug.Assert(!innerException.IsFatal(), "Fatal exception passed in as InnerException");
 }
开发者ID:OpenRIAServices,项目名称:OpenRiaServices,代码行数:23,代码来源:AttributeBuilderException.cs

示例6: DomainException

 /// <summary>
 /// Constructor that accepts a localized exception message and an inner exception.
 /// </summary>
 /// <param name="message">The localized exception message.</param>
 /// <param name="innerException">The inner exception.</param>
 public DomainException(string message, Exception innerException)
     : base(message, innerException)
 {
     Debug.Assert(!innerException.IsFatal(), "Fatal exception passed in as InnerException");
 }
开发者ID:OpenRIAServices,项目名称:OpenRiaServices,代码行数:10,代码来源:DomainException.cs

示例7: IsLogged

 private static bool IsLogged(Exception ex)
 {
     return !ex.IsFatal();
 }
开发者ID:qhme,项目名称:OrchardLite,代码行数:4,代码来源:SessionLocator.cs

示例8: DomainDataServiceException

        /// <summary>
        /// Initializes a new instance of the DomainDataServiceException class.
        /// </summary>
        /// <param name="statusCode">HTTP response status code for this exception.</param>
        /// <param name="message">Plain text error message for this exception.</param>
        /// <param name="innerException">Exception that caused this exception to be thrown.</param>
        public DomainDataServiceException(int statusCode, string message, Exception innerException)
            : base(message, innerException)
        {
            Debug.Assert(!innerException.IsFatal(), "Fatal exception passed in as InnerException");

            this.errorCode = String.Empty;
            this.messageLanguage = CultureInfo.CurrentCulture.Name;
            this.statusCode = statusCode;
        }
开发者ID:OpenRIAServices,项目名称:OpenRiaServices,代码行数:15,代码来源:DomainDataServiceException.cs

示例9: IsLogged

 private static bool IsLogged(Exception ex)
 {
     return ex is CoeverySecurityException || !ex.IsFatal();
 }
开发者ID:gokhandisikara,项目名称:Coevery-Framework,代码行数:4,代码来源:SessionLocator.cs

示例10: IsTransient

 /// <summary>
 /// Always returns false.
 /// 
 /// </summary>
 /// <param name="ex">The exception.</param>
 /// <returns>
 /// Always false.
 /// </returns>
 public bool IsTransient(Exception ex)
 {
     return !ex.IsFatal();
 }
开发者ID:Fricsay,项目名称:azure-iot-sdks,代码行数:12,代码来源:TransientErrorIgnoreStrategy.cs


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