-
-
Notifications
You must be signed in to change notification settings - Fork 761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FieldBindingFlags.Default Error Types Throw SchemaException #7111
Comments
This is actually not a bug ... what we do internally is register an error type for mutation convention errors ... this is the |
@michaelstaib, thanks for the follow up. You're right when using the code below, it internally registers an error type for the mutation conventions and does not raise any [MutationType]
public class LibraryMutation
{
[Error<DomainException>]
public Library? LibraryCreate(string name)
{
throw new DomainException("bad");
}
}
public class DomainException(string type) : Exception
{
public string Message => "a domain exception was thrown...";
public string Type { get; } = type;
} The issue that now arises is that I am unable to configure which fields I want to expose to the GraphQL layer (or I might be doing it incorrectly). Without configuring the object type extension, it only exposes the Introducing the following object type configuration does not resolve the issue, as only the [ObjectType<DomainException>]
public static partial class DomainExceptionType
{
static partial void Configure(IObjectTypeDescriptor<DomainException> descriptor)
{
descriptor
.Field(p => p.Message);
descriptor
.Field(p => p.Type);
}
} How can I configure these additional fields on the exceptions so that they are exposed in the GraphQL layer, while still using |
Fixed by #7548 |
Product
Hot Chocolate
Version
14.0.0-p.100
Link to minimal reproduction
https://github.com/PHILLIPS71/HC-7111
Steps to reproduce
When using the
FieldBindingFlags.Default
with mutation conventions, error types do not function as expected, despite having object types defined for the exceptions and or errors being thrown.What is expected?
If exceptions or object types are properly defined and expose the message field, a
SchemaException
should not occur.What is actually happening?
It consistently throws a
SchemaException
, indicating that the exception does not expose a message property.Relevant log output
Additional context
No response
The text was updated successfully, but these errors were encountered: