forked from fsprojects/FSharp.Data.GraphQL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTypeSystem.fs
More file actions
16 lines (13 loc) · 770 Bytes
/
Copy pathTypeSystem.fs
File metadata and controls
16 lines (13 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// The MIT License (MIT)
// Copyright (c) 2016 Bazinga Technologies Inc
[<AutoOpen>]
module FSharp.Data.GraphQL.Types.ResolveFieldContextExtensions
open FSharp.Data.GraphQL
open FSharp.Data.GraphQL.Extensions
type ResolveFieldContext with
/// Returns an argument by provided name. If argument was not found a GraphQL exception will be thrown.
/// <exception cref="GraphQLException">When argument with the name not found in the Args.</exception>
member x.Arg(name : string) : 't =
match Map.tryFind name x.Args with
| Some found -> downcast found
| None -> raise (GQLMessageException $"Argument '%s{name}' was not provided within context of a field '%s{x.ExecutionInfo.Identifier}'. Check if it was supplied within GraphQL query.")