mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 03:01:31 +00:00
Add exception for exceeding the private quota
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user