using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Runtime.Serialization; using System.Security; namespace Octokit { [Serializable] [SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Justification = "These exceptions are specific to the GitHub API and not general purpose exceptions")] public class RepositoryFormatException : Exception { readonly string message; public RepositoryFormatException(IEnumerable invalidRepositories) { var parameterList = string.Join(", ", invalidRepositories); message = string.Format( CultureInfo.InvariantCulture, "The list of repositories must be formatted as 'owner/name' - these values don't match this rule: {0}", parameterList); } public override string Message { get { return message; } } /// /// Constructs an instance of LoginAttemptsExceededException /// /// /// The that holds the /// serialized object data about the exception being thrown. /// /// /// The that contains /// contextual information about the source or destination. /// protected RepositoryFormatException(SerializationInfo info, StreamingContext context) : base(info, context) { if (info == null) return; message = info.GetString("Message"); } [SecurityCritical] public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue("Message", Message); } } }