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; }
public static void HandleException(System.Exception ex, ILogger logger, string sourceType, string method) { if (IsLogged(ex)) { logger.LogError(string.Format("{2} thrown from {0} by {1}", sourceType, method, ex.GetType().Name), ex); } if (ex.IsFatal()) { throw ex; } }
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; }
private static bool IsLogged(Exception ex) { return ex is OrchardSecurityException || !ex.IsFatal(); }
/// <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 }
/// <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"); }
private static bool IsLogged(System.Exception ex) { return(!ex.IsFatal()); }
/// <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"); }
private static bool IsLogged(Exception ex) { return !ex.IsFatal(); }
/// <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; }
private static bool IsLogged(Exception ex) { return ex is CoeverySecurityException || !ex.IsFatal(); }
/// <summary> /// Always returns false. /// /// </summary> /// <param name="ex">The exception.</param> /// <returns> /// Always false. /// </returns> public bool IsTransient(Exception ex) { return !ex.IsFatal(); }