using System; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Net; #if !NO_SERIALIZABLE using System.Runtime.Serialization; #endif namespace Octokit { /// /// Represents an error that occurs when trying to convert a user /// that is not a member of the organization to an outside collaborator /// #if !NO_SERIALIZABLE [Serializable] #endif [SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Justification = "These exceptions are specific to the GitHub API and not general purpose exceptions")] public class UserIsNotMemberOfOrganizationException : ApiException { /// /// Constructs an instance of the class. /// /// The HTTP payload from the server public UserIsNotMemberOfOrganizationException(IResponse response) : this(response, null) { } /// /// Constructs an instance of the class. /// /// The HTTP payload from the server /// The inner exception public UserIsNotMemberOfOrganizationException(IResponse response, ApiException innerException) : base(response, innerException) { Debug.Assert(response != null && response.StatusCode == HttpStatusCode.NotFound, "UserIsNotMemberOfOrganizationException created with the wrong HTTP status code"); } // https://developer.github.com/v3/orgs/outside_collaborators/#response-if-user-is-not-a-member-of-the-organization public override string Message => ApiErrorMessageSafe ?? "User is not a member of the organization."; #if !NO_SERIALIZABLE /// /// Constructs an instance of ForbiddenException /// /// /// The that holds the /// serialized object data about the exception being thrown. /// /// /// The that contains /// contextual information about the source or destination. /// protected UserIsNotMemberOfOrganizationException(SerializationInfo info, StreamingContext context) : base(info, context) { } #endif } }