Hi,
It hase become a must have that i can return meaningful errror messages from the graphql api.
AFAIK this is not yet possible.
I thus recommend following new feature:
So i could simply throw a message inside a resolver like:
thrown new GraphQL.CustomException($"insufficent permissions, und need the permission {RequiredPermission}");
and it will be displayed in errors (without Lines)
@joemcbride What do you think of this feature ? Are u gonna accept a pull request for this ?
Note: The example maybe isn't good, as permission are handled outside the resolver. But in my case it would be like:
thrown new GraphQL.CustomException($"insufficent licenses, please buy more licenses in the license menu");
You can add custom errors in the ResolveFieldContext. I think this should solve your issue?
context =>
{
context.Errors.Add(new ExecutionError("Some Error"));
return null;
}
See your previous issue: https://github.com/graphql-dotnet/graphql-dotnet/issues/351
oops, sorry missed that this was implemented. thanks a lot.
Most helpful comment
You can add custom errors in the
ResolveFieldContext. I think this should solve your issue?