public static IReadOnlyList <IClientError>?ParseErrors(JsonElement result) { if (result is { ValueKind : JsonValueKind.Array } errors) { var array = new IClientError[errors.GetArrayLength()]; var i = 0; foreach (JsonElement error in errors.EnumerateArray()) { try { array[i] = ParseError(error); } catch (Exception ex) { array[i] = new ClientError( JsonErrorParser_ParseErrors_Error, exception: ex); } i++; } return(array); } return(null); }
public GraphQLClientException(IClientError error) : base(error?.Message) { if (error is null) { throw new ArgumentNullException(nameof(error)); } Errors = new[] { error }; }
/// <summary> /// Creates a new exception that is caused by the specified client <see cref="error"/>. /// </summary> /// <param name="error"> /// The client error. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="error"/> is <c>null</c>. /// </exception> public GraphQLClientException(IClientError error) { if (error is null) { throw new ArgumentNullException(nameof(error)); } Message = error.Message; Errors = new[] { error }; }
public ResultMock(IClientError error) { Errors = new[] { error }; }