-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGraphQueryTranslationException.cs
More file actions
35 lines (31 loc) · 1.38 KB
/
Copy pathGraphQueryTranslationException.cs
File metadata and controls
35 lines (31 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System.Linq.Expressions;
namespace Linq2GraphQL.Client;
/// <summary>
/// Thrown when an expression passed to <c>Include</c> or <c>Select</c> cannot be turned into a GraphQL
/// selection, either because it uses a construct that has no GraphQL equivalent or because it reads
/// something that is not part of the query.
/// </summary>
/// <remarks>
/// The query text does not exist yet when translation fails, so unlike
/// <see cref="GraphQueryRequestException" /> and <see cref="GraphQueryExecutionException" /> this
/// exception carries the offending <see cref="Expression" /> instead.
/// It derives from <see cref="NotSupportedException" />, which is what the parser threw before this type
/// existed, so callers that catch that keep working.
/// </remarks>
public class GraphQueryTranslationException : NotSupportedException
{
public GraphQueryTranslationException(string message, Expression expression, string memberName = null)
: base(message)
{
Expression = expression;
MemberName = memberName;
}
/// <summary>
/// The part of the expression that could not be translated.
/// </summary>
public Expression Expression { get; }
/// <summary>
/// The LINQ operator or GraphQL member the failure is about, when it is about a single one.
/// </summary>
public string MemberName { get; }
}