Files
octokit.net/Octokit/Helpers/ApiErrorExtensions.cs
Haacked dae6cb2ca6 Implement RepositoryExistsException
This exception is thrown when we try to create a repository but it
already exists on the server.
2014-02-18 21:03:29 -08:00

17 lines
449 B
C#

using System.Linq;
namespace Octokit
{
internal static class ApiErrorExtensions
{
public static string FirstErrorMessageSafe(this ApiError apiError)
{
if (apiError == null) return null;
if (apiError.Errors == null) return null;
var firstError = apiError.Errors.FirstOrDefault();
if (firstError == null) return null;
return firstError.Message;
}
}
}