Open hahn-kev opened 1 year ago
Can you create a small project that demonstrates the issue and upload it to this issue?
here you go. Just create a project and install hot chocolate aspnet core.
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddGraphQLServer()
.AddMutationType<MyMutations>()
.AddMutationConventions(false)
.InitializeOnStartup();
var app = builder.Build();
app.Run();
public class GqlDbError
{
public GqlDbError(NullReferenceException e)
{
}
public GqlDbError(ApplicationException e)
{
}
public string Message { get; set; }
}
public class MyMutations
{
[Error<GqlDbError>]
[UseMutationConvention]
public string Test()
{
return "test";
}
}
Is there an existing issue for this?
Product
Hot Chocolate
Describe the bug
I've declared a custom error type that I would like to use in a mutation. When I define 2 constructors for different exceptions I get this error when trying to generate a schema.
Steps to reproduce
https://github.com/glen-84/hc-5991 (.NET 8, HC 13.8.1)
[Error<GqlDbError>] [UseMutationConvention]
GqlDbError
with 2 constructors each taking a different exception typeRelevant log output
Additional Context?
as a workaround I'm using static factory methods instead.
Version
13.0.5