using System; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Net; using System.Runtime.Serialization; namespace Octokit { /// /// Represents an error that occurs when the pull request is in an /// unmergeable state /// [Serializable] [SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Justification = "These exceptions are specific to the GitHub API and not general purpose exceptions")] public class PullRequestNotMergeableException : ApiException { /// /// Constructs an instance of the class. /// /// The HTTP payload from the server public PullRequestNotMergeableException(IResponse response) : this(response, null) { } /// /// Constructs an instance of the class. /// /// The HTTP payload from the server /// The inner exception public PullRequestNotMergeableException(IResponse response, Exception innerException) : base(response, innerException) { Debug.Assert(response != null && response.StatusCode == HttpStatusCode.MethodNotAllowed, "PullRequestNotMergeableException created with the wrong HTTP status code"); } public override string Message { //https://developer.github.com/v3/pulls/#response-if-merge-cannot-be-performed get { return ApiErrorMessageSafe ?? "Pull Request is not mergeable"; } } /// /// 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 PullRequestNotMergeableException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }