mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-06 07:16:09 +00:00
16 lines
440 B
C#
16 lines
440 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 apiError.Message;
|
|
var firstError = apiError.Errors.FirstOrDefault();
|
|
return firstError == null ? null : firstError.Message;
|
|
}
|
|
}
|
|
}
|