diff --git a/Octokit/Helpers/StringExtensions.cs b/Octokit/Helpers/StringExtensions.cs index 1823dc81..33008b3e 100644 --- a/Octokit/Helpers/StringExtensions.cs +++ b/Octokit/Helpers/StringExtensions.cs @@ -101,5 +101,16 @@ namespace Octokit //We need to have the last word. yield return new String(letters, wordStartIndex, letters.Length - wordStartIndex); } + + static Regex nameWithOwner = new Regex("[a-zA-Z.]{1,}/[a-zA-Z.]{1,}" +#if (!PORTABLE && !NETFX_CORE) +, RegexOptions.Compiled +#endif +); + + internal static bool IsNameWithOwnerFormat(this string input) + { + return nameWithOwner.IsMatch(input); + } } } diff --git a/Octokit/Models/Request/SearchIssuesRequest.cs b/Octokit/Models/Request/SearchIssuesRequest.cs index e07f4789..edbaaf6e 100644 --- a/Octokit/Models/Request/SearchIssuesRequest.cs +++ b/Octokit/Models/Request/SearchIssuesRequest.cs @@ -267,15 +267,10 @@ namespace Octokit if (Repos.Any()) { - var invalidFormatRepos = Repos.Where(x => !IsNameWithOwnerFormat(x)); + var invalidFormatRepos = Repos.Where(x => !x.IsNameWithOwnerFormat()); if (invalidFormatRepos.Any()) { - var parameterList = string.Join(", ", invalidFormatRepos); - var message = string.Format( - CultureInfo.InvariantCulture, - "The list of repositories must be formatted as 'owner/name' - these values don't match this rule: {0}", - parameterList); - throw new ArgumentException(message); + throw new RepositoryFormatException(invalidFormatRepos); } parameters.Add( @@ -285,19 +280,6 @@ namespace Octokit return new ReadOnlyCollection(parameters); } - // what rules do we define here? - - static Regex nameWithOwner = new Regex("[a-zA-Z.]{1,}/[a-zA-Z.]{1,}" -#if (!PORTABLE && !NETFX_CORE) - , RegexOptions.Compiled -#endif - ); - - static bool IsNameWithOwnerFormat(string input) - { - return nameWithOwner.IsMatch(input); - } - internal string DebuggerDisplay { get