當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。