GetBuildsStatuses() public method

public GetBuildsStatuses ( SirenOfShame.Lib.Settings.CiEntryPointSetting ciEntryPointSetting, BuildDefinitionSetting watchedBuildDefinitions ) : Task>
ciEntryPointSetting SirenOfShame.Lib.Settings.CiEntryPointSetting
watchedBuildDefinitions SirenOfShame.Lib.Settings.BuildDefinitionSetting
return Task>
Exemplo n.º 1
0
        protected override IList <BuildStatus> GetBuildStatus()
        {
            var watchedBuildDefinitions = GetAllWatchedBuildDefinitions().ToArray();

            if (string.IsNullOrEmpty(CiEntryPointSetting.Url))
            {
                throw new SosException("TFS URL is null or empty");
            }

            try
            {
                return(_service.GetBuildsStatuses(CiEntryPointSetting, watchedBuildDefinitions).Result
                       .Cast <BuildStatus>().ToList());
            }
            catch (WebException ex)
            {
                if (
                    ex.Message.StartsWith("The remote name could not be resolved:") ||
                    ex.Message.Contains("Unable to connect to the remote server")
                    )
                {
                    throw new ServerUnavailableException();
                }
                throw;
            }
        }
Exemplo n.º 2
0
        protected override IList <BuildStatus> GetBuildStatus()
        {
            var watchedBuildDefinitions = GetAllWatchedBuildDefinitions().ToArray();

            if (string.IsNullOrEmpty(CiEntryPointSetting.Url))
            {
                throw new SosException("TFS URL is null or empty");
            }

            try
            {
                return(_service.GetBuildsStatuses(CiEntryPointSetting, watchedBuildDefinitions).Result
                       .Cast <BuildStatus>().ToList());
            }
            catch (AggregateException ex)
            {
                var anyInvalidCredentials = ex.InnerExceptions.Any(IsInvalidCredentials);
                if (anyInvalidCredentials)
                {
                    throw new InvalidCredentialsException();
                }

                var anyServerUnavailable = ex.InnerExceptions.Any(IsServerUnavailable);
                if (anyServerUnavailable)
                {
                    throw new ServerUnavailableException();
                }

                throw;
            }
            catch (WebException ex)
            {
                var isServerUnavailable = IsServerUnavailable(ex);
                if (isServerUnavailable)
                {
                    throw new ServerUnavailableException();
                }
                throw;
            }
        }
        protected override IList <BuildStatus> GetBuildStatus()
        {
            var watchedBuildDefinitions = GetAllWatchedBuildDefinitions().ToArray();

            if (string.IsNullOrEmpty(CiEntryPointSetting.Url))
            {
                throw new SosException("TFS URL is null or empty");
            }

            try
            {
                return(_service.GetBuildsStatuses(CiEntryPointSetting, watchedBuildDefinitions).Result
                       .Cast <BuildStatus>().ToList());
            }
            catch (AggregateException ex)
            {
                var anyServerUnavailable = ex.InnerExceptions.Any(IsServerUnavailable);
                if (anyServerUnavailable)
                {
                    throw new ServerUnavailableException();
                }

                var taskCancelledException = ex.InnerExceptions.FirstOrDefault(x => x is TaskCanceledException);
                if (!ReferenceEquals(null, taskCancelledException))
                {
                    throw taskCancelledException;
                }
                throw;
            }
            catch (WebException ex)
            {
                var isServerUnavailable = IsServerUnavailable(ex);
                if (isServerUnavailable)
                {
                    throw new ServerUnavailableException();
                }
                throw;
            }
        }