You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varbuilder= WebApplication.CreateBuilder(args);
builder.Services
.AddGraphQLServer().AddQueryType<Query>().AddTypeConverter<string,UserId>(UserId.Parse).AddTypeConverter<UserId,string>(id => id.Value.ToString()).BindRuntimeType<UserId,StringType>();varapp= builder.Build();
app.MapGraphQL();
app.Run();publicrecordUserId(intValue){publicstatic UserId Parse(stringid){if(Int32.TryParse(id,outint result)){returnnew UserId(result);}thrownew SerializationException("User ID must be an integer",new StringType());}}publicclassQuery{publicstringTest(UserIdarg)=>"";}
Run this query:
query {
test(arg: "invalid")
}
What is expected?
An error containing the message User ID must be an integer. Furthermore, the error, being targeted to clients, should not in any way reference the type name UserId (which is an internal Server implementation detail and not part of the schema).
What is actually happening?
The following error, which:
does not use my supplied error message
references the internal type name in both message and extensions.requestedType
is generally clearly oriented to server implementors
{
"errors": [
{
"message": "Unable to convert the value of the argument `arg` to `UserId`. Check if the requested type is correct or register a custom type converter.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"test"
],
"extensions": {
"fieldName": "test",
"argumentName": "arg",
"requestedType": "UserId"
}
}
],
"data": {
"test": null
}
}
Relevant log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Product
Hot Chocolate
Version
14.0.0-rc.0
Link to minimal reproduction
See zip below
Steps to reproduce
Repro solution: HotChocolateBugRepro.zip
Code for quick reference:
Run this query:
What is expected?
An error containing the message
User ID must be an integer
. Furthermore, the error, being targeted to clients, should not in any way reference the type nameUserId
(which is an internal Server implementation detail and not part of the schema).What is actually happening?
The following error, which:
message
andextensions.requestedType
Relevant log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: