Orc.NuGetExplorer.NuGetFeedVerificationService.VerifyFeed C# (CSharp) Method

VerifyFeed() private method

private VerifyFeed ( string source, bool authenticateIfRequired = true ) : FeedVerificationResult
source string
authenticateIfRequired bool
return FeedVerificationResult
        public FeedVerificationResult VerifyFeed(string source, bool authenticateIfRequired = true)
        {
            var result = FeedVerificationResult.Valid;

            Log.Debug("Verifying feed '{0}'", source);

            using (ScopeManager<AuthenticationScope>.GetScopeManager(source.GetSafeScopeName(), () => new AuthenticationScope(authenticateIfRequired)))
            {
                try
                {
                    var repository = _packageRepositoryFactory.CreateRepository(source);
                    var anyExists = repository.GetPackages().Take(1).Count();
                }
                catch (WebException ex)
                {
                    result = HandleWebException(ex, source);
                }
                catch (UriFormatException ex)
                {
                    Log.Debug(ex, "Failed to verify feed '{0}', a UriFormatException occurred", source);

                    result = FeedVerificationResult.Invalid;
                }
                catch (Exception ex)
                {
                    Log.Debug(ex, "Failed to verify feed '{0}'", source);

                    result = FeedVerificationResult.Invalid;
                }
            }

            Log.Debug("Verified feed '{0}', result is '{1}'", source, result);

            return result;
        }