Skip to content

Commit 955ec87

Browse files
committed
Fixed coerceUriInput definition to use the common error creation
1 parent 01ced21 commit 955ec87

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/FSharp.Data.GraphQL.Shared/SchemaDefinitions.fs

+5-4
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,18 @@ module SchemaDefinitions =
294294

295295
/// Tries to resolve AST query input to URI.
296296
let coerceUriInput =
297+
let destinationType = "URI"
297298
function
298299
| Variable e when e.ValueKind = JsonValueKind.String ->
299300
match Uri.TryCreate(e.GetString(), UriKind.RelativeOrAbsolute) with
300301
| true, uri -> Ok uri
301-
| false, _ -> Error [{ new IGQLError with member _.Message = $"Cannot deserialize '{e.GetRawText()}' into URI" }]
302-
| Variable e -> e.GetDeserializeError "URI"
302+
| false, _ -> e.GetDeserializeError destinationType
303+
| Variable e -> e.GetDeserializeError destinationType
303304
| InlineConstant (StringValue s) ->
304305
match Uri.TryCreate(s, UriKind.RelativeOrAbsolute) with
305306
| true, uri -> Ok uri
306-
| false, _ -> Error [{ new IGQLError with member _.Message = $"Cannot parse '{s}' into URI" }]
307-
| InlineConstant value -> value.GetCoerceError "URI"
307+
| false, _ -> getParseError destinationType s
308+
| InlineConstant value -> value.GetCoerceError destinationType
308309

309310
/// Tries to resolve AST query input to DateTimeOffset.
310311
let coerceDateTimeOffsetInput =

0 commit comments

Comments
 (0)