public ExceptionHandlerBase <TMessageDescription> GetHandler(ExceptionHandlingPolicy policy) { if (_supportedPolicies.TryGetValue(policy, out var handler) == false) { throw new NotSupportedException($"Policy {policy.ToString()} is not supported"); } return(handler); }
protected ExceptionHandlerBase(ILogger logger, ExceptionHandlingPolicy exceptionHandlingPolicy) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } Logger = logger; ExceptionHandlingPolicy = exceptionHandlingPolicy; }
public static void RegardlessOfExceptionHandlingPolicy(this Action assertion, Action cleanupCase) { cleanupCase = cleanupCase ?? new Action(() => { }); ExceptionHandlingPolicy defaultSettings = DiagnosticSettings.Custom.ExceptionHandlingPolicy; DiagnosticSettings.Custom.ExceptionHandlingPolicy = ExceptionHandlingPolicy.TurnOffTheSubscription; assertion(); cleanupCase(); DiagnosticSettings.Custom.ExceptionHandlingPolicy = ExceptionHandlingPolicy.FailFast; assertion(); cleanupCase(); DiagnosticSettings.Custom.ExceptionHandlingPolicy = defaultSettings; }
/// <summary> /// Handles the exception. /// </summary> /// <param name="exception">The exception.</param> /// <param name="policy">The policy.</param> /// <returns>bool</returns> public bool HandleException(Exception exception, ExceptionHandlingPolicy policy) { return(ExceptionPolicy.HandleException(exception, policy.GetDescription())); }
/// <summary> /// Handles the exception. /// </summary> /// <param name="exception">The exception.</param> /// <param name="policy">The policy.</param> /// <param name="execptionToThrow">The execption to throw.</param> /// <returns>bool</returns> public bool HandleException(Exception exception, ExceptionHandlingPolicy policy, out Exception execptionToThrow) { return(ExceptionPolicy.HandleException(exception, policy.GetDescription(), out execptionToThrow)); }
internal void Reset() { this.exceptionHandlingPolicy = xReactor.ExceptionHandlingPolicy.FailFast; }