Exemplo n.º 1
0
        private T InvokeWithExceptionHandling <T>(IConfigurationSource source, Func <IConfigurationSource, T> function)
            where T : class
        {
            try
            {
                return(function(source));
            }
            catch (Exception ex)
            {
                var handleResult = new SourceExceptionHandleResult();

                _onSourceExceptions.ForEach(onSourceException => onSourceException(source, ex, handleResult));

                if (!handleResult.IsHandled)
                {
                    throw;
                }

                return(source.GetDefaultSettingObject() as T);
            }
        }