Add exception for exceeding the private quota

This commit is contained in:
Haacked
2014-02-18 22:41:19 -08:00
parent 8fa98fa99a
commit 34ac57ccab
9 changed files with 133 additions and 3 deletions
@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Octokit
{
/// <summary>
/// Exception thrown when creating a private repository, but the user's private quota is or would be exceeded
/// by creating it.
/// </summary>
#if !NETFX_CORE
[Serializable]
#endif
[SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors",
Justification = "These exceptions are specific to the GitHub API and not general purpose exceptions")]
public class PrivateRepositoryQuotaExceededException : ApiValidationException
{
/// <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)
{
}
public override string Message
{
get
{
// TODO: Would be nice to show the actual numbers, but that requires another request.
return "You are currently at your limit of private repositories. Either delete a private repository "
+ "you no longer use or upgrade your account to a plan that allows for more private repositories.";
}
}
#if !NETFX_CORE
protected PrivateRepositoryQuotaExceededException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif
}
}