using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.Serialization;
namespace Octokit
{
///
/// Exception thrown when Secondary GitHub API Rate limits are exceeded.
///
///
///
/// This occurs when GitHub perceives misuse of the API. You may get this if
/// you are polling heavily, creating content rapidly or making concurrent requests.
///
/// See https://docs.github.com/rest/overview/resources-in-the-rest-api#secondary-rate-limits for more details.
///
[Serializable]
[SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors",
Justification = "These exceptions are specific to the GitHub API and not general purpose exceptions")]
public class SecondaryRateLimitExceededException : ForbiddenException
{
///
/// Constructs an instance of the class.
///
/// The HTTP payload from the server
public SecondaryRateLimitExceededException(IResponse response) : this(response, null)
{
}
///
/// Constructs an instance of the class.
///
/// The HTTP payload from the server
/// The inner exception
public SecondaryRateLimitExceededException(IResponse response, Exception innerException) : base(response, innerException)
{
Ensure.ArgumentNotNull(response, nameof(response));
}
public override string Message
{
get { return ApiErrorMessageSafe ?? "Secondary API Rate Limit exceeded"; }
}
///
/// Constructs an instance of .
///
///
/// The that holds the
/// serialized object data about the exception being thrown.
///
///
/// The that contains
/// contextual information about the source or destination.
///
protected SecondaryRateLimitExceededException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}