Ejemplo n.º 1
0
        /// <summary>
        /// Constructs an instance of RepositoryExistsException.
        /// </summary>
        /// <param name="owner">The login of the owner of the existing repository</param>
        /// <param name="name">The name of the existing repository</param>
        /// <param name="baseAddress">The base address of the repository.</param>
        /// <param name="innerException">The inner validation exception.</param>
        public RepositoryExistsException(
            string owner,
            string name,
            Uri baseAddress,
            ApiValidationException innerException)
            : base(innerException)
        {
            Ensure.ArgumentNotNullOrEmptyString(name, "repositoryName");
            Ensure.ArgumentNotNull(baseAddress, "baseAddress");

            Owner = owner;
            RepositoryName = name;
            OwnerIsOrganization = !String.IsNullOrWhiteSpace(owner);
            var webBaseAddress = baseAddress.Host != GitHubClient.GitHubApiUrl.Host
                        ? baseAddress
                        : GitHubClient.GitHubDotComUrl;
            ExistingRepositoryWebUrl = OwnerIsOrganization 
                ? new Uri(webBaseAddress, new Uri(owner + "/" + name, UriKind.Relative))
                : null;
            string messageFormat = OwnerIsOrganization 
                ? "There is already a repository named '{0}' in the organization '{1}'."
                : "There is already a repository named '{0}' for the current account.";

            _message = String.Format(CultureInfo.InvariantCulture, messageFormat, name, owner);
        }
        /// <summary>
        /// Constructs an instance of RepositoryExistsException.
        /// </summary>
        /// <param name="owner">The login of the owner of the existing repository</param>
        /// <param name="name">The name of the existing repository</param>
        /// <param name="baseAddress">The base address of the repository.</param>
        /// <param name="innerException">The inner validation exception.</param>
        public RepositoryExistsException(
            string owner,
            string name,
            Uri baseAddress,
            ApiValidationException innerException)
            : base(innerException)
        {
            Ensure.ArgumentNotNullOrEmptyString(name, "repositoryName");
            Ensure.ArgumentNotNull(baseAddress, "baseAddress");

            Owner               = owner;
            RepositoryName      = name;
            OwnerIsOrganization = !String.IsNullOrWhiteSpace(owner);
            var webBaseAddress = baseAddress.Host != GitHubClient.GitHubApiUrl.Host
                        ? baseAddress
                        : GitHubClient.GitHubDotComUrl;

            ExistingRepositoryWebUrl = OwnerIsOrganization
                ? new Uri(webBaseAddress, new Uri(owner + "/" + name, UriKind.Relative))
                : null;
            string messageFormat = OwnerIsOrganization
                ? "There is already a repository named '{0}' in the organization '{1}'."
                : "There is already a repository named '{0}' for the current account.";

            _message = String.Format(CultureInfo.InvariantCulture, messageFormat, name, owner);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructs an instance of RepositoryExistsException for an account.
        /// </summary>
        /// <param name="name">The name of the existing repository</param>
        /// <param name="innerException">The inner validation exception</param>
        public RepositoryExistsException(
            string name,
            ApiValidationException innerException)
            : base(innerException)
        {
            Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));

            RepositoryName = name;

            _message = string.Format(CultureInfo.InvariantCulture, "There is already a repository named '{0}' for the current account.", name);
        }
        /// <summary>
        /// Constructs an instance of RepositoryExistsException for an account.
        /// </summary>
        /// <param name="name">The name of the existing repository</param>
        /// <param name="innerException">The inner validation exception</param>
        public RepositoryExistsException(
            string name,
            ApiValidationException innerException)
            : base(innerException)
        {
            Ensure.ArgumentNotNullOrEmptyString(name, "name");

            RepositoryName = name;

            _message = String.Format(CultureInfo.InvariantCulture, "There is already a repository named '{0}' for the current account.", name);
        }
        /// <summary>
        /// Constructs an instance of RepositoryExistsException for an organization.
        /// </summary>
        /// <param name="organization">The name of the organization of the existing repository</param>
        /// <param name="name">The name of the existing repository</param>
        /// <param name="baseAddress">The base address of the repository.</param>
        /// <param name="innerException">The inner validation exception.</param>
        public RepositoryExistsException(
            string organization,
            string name,
            Uri baseAddress,
            ApiValidationException innerException)
            : base(innerException)
        {
            Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNull(baseAddress, "baseAddress");

            Organization = organization;
            RepositoryName = name;
            OwnerIsOrganization = true;
            var webBaseAddress = baseAddress.Host != GitHubClient.GitHubApiUrl.Host
                        ? baseAddress
                        : GitHubClient.GitHubDotComUrl;
            ExistingRepositoryWebUrl = new Uri(webBaseAddress, new Uri(organization + "/" + name, UriKind.Relative));
            
            _message = string.Format(CultureInfo.InvariantCulture, "There is already a repository named '{0}' in the organization '{1}'.", name, organization);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Constructs an instance of RepositoryExistsException for an organization.
        /// </summary>
        /// <param name="organization">The name of the organization of the existing repository</param>
        /// <param name="name">The name of the existing repository</param>
        /// <param name="baseAddress">The base address of the repository.</param>
        /// <param name="innerException">The inner validation exception.</param>
        public RepositoryExistsException(
            string organization,
            string name,
            Uri baseAddress,
            ApiValidationException innerException)
            : base(innerException)
        {
            Ensure.ArgumentNotNullOrEmptyString(organization, nameof(organization));
            Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
            Ensure.ArgumentNotNull(baseAddress, nameof(baseAddress));

            Organization        = organization;
            RepositoryName      = name;
            OwnerIsOrganization = true;
            var webBaseAddress = baseAddress.Host != GitHubClient.GitHubApiUrl.Host
                        ? baseAddress
                        : GitHubClient.GitHubDotComUrl;

            ExistingRepositoryWebUrl = new Uri(webBaseAddress, new Uri(organization + "/" + name, UriKind.Relative));

            _message = string.Format(CultureInfo.InvariantCulture, "There is already a repository named '{0}' in the organization '{1}'.", name, organization);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Constructs an instance of ApiValidationException
 /// </summary>
 /// <param name="innerException">The inner validation exception.</param>
 public InvalidGitIgnoreTemplateException(ApiValidationException innerException)
     : base(innerException)
 { }
 /// <summary>
 /// Constructs an instance of PrivateRepositoryQuotaExceededException.
 /// </summary>
 /// <param name="innerException">The inner validation exception.</param>
 public PrivateRepositoryQuotaExceededException(ApiValidationException innerException)
     : base(innerException)
 {
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Constructs an instance of ApiValidationException
 /// </summary>
 /// <param name="innerException">The inner validation exception.</param>
 public InvalidGitIgnoreTemplateException(ApiValidationException innerException)
     : base(innerException)
 {
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Constructs an instance of ApiValidationException
 /// </summary>
 /// <param name="innerException">The inner exception</param>
 protected ApiValidationException(ApiValidationException innerException)
     : base(innerException)
 {
 }
 /// <summary>
 /// Constructs an instance of PrivateRepositoryQuotaExceededException.
 /// </summary>
 /// <param name="owner">The login of the owner of the existing repository</param>
 /// <param name="name">The name of the existing repository</param>
 /// <param name="ownerIsOrganization">True if the owner is an organization</param>
 /// <param name="baseAddress">The base address of the repository.</param>
 /// <param name="innerException">The inner validation exception.</param>
 public PrivateRepositoryQuotaExceededException(ApiValidationException innerException)
     : base(innerException)
 {
 }
Ejemplo n.º 12
0
 protected ApiValidationException(ApiValidationException innerException) : base(innerException)
 {
 }