/// <summary> /// Creates an instance of a exception manager. /// </summary> /// <returns>Returns an instance of the <see cref="IDaExceptionManager"/> interface.</returns> public static IDaExceptionManager CreateExceptionManager() { var exceptionHandlingConfiguration = DaExceptionHandlingConfigurationManager.GetConfiguration(); if (exceptionHandlingConfiguration == null) { throw new InvalidOperationException(Resources.ExceptionHandlingConfigNotSet); } var providerConfig = exceptionHandlingConfiguration.Providers.GetByName(exceptionHandlingConfiguration.DefaultProvider); Type type = Type.GetType(providerConfig.Type); var exceptionManager = (IDaExceptionManager)Activator.CreateInstance(type); return(exceptionManager); }
/// <summary> /// Handles an exception with the default exception handling policy. /// </summary> /// <param name="ex">The exception to be handled.</param> public void HandleExpcetion(Exception ex) { if (ex == null) { throw new ArgumentNullException(nameof(ex)); } var settings = DaExceptionHandlingConfigurationManager.GetConfiguration(); string defaultExceptionPolicy = "Default Exception Policy"; if (settings != null) { defaultExceptionPolicy = settings.DefaultExceptionPolicy; } HandleExpcetion(ex, defaultExceptionPolicy); }