本文整理汇总了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;
}
示例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;
}
示例3: IsLogged
private static bool IsLogged(Exception ex) {
return ex is OrchardSecurityException || !ex.IsFatal();
}
示例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
}
示例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");
}
示例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");
}
示例7: IsLogged
private static bool IsLogged(Exception ex)
{
return !ex.IsFatal();
}
示例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;
}
示例9: IsLogged
private static bool IsLogged(Exception ex)
{
return ex is CoeverySecurityException || !ex.IsFatal();
}
示例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();
}