Skip to content
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

Update mutations.md #5598

Merged
merged 2 commits into from
Dec 12, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 22 additions & 22 deletions website/src/docs/hotchocolate/v13/defining-a-schema/mutations.md
Original file line number Diff line number Diff line change
Expand Up @@ -577,14 +577,14 @@ public class UserNameTakenError
Message = $"The username {username} is already taken.";
}

public static MyCustomError CreateErrorFrom(UserNameTakenException ex)
public static UserNameTakenError CreateErrorFrom(UserNameTakenException ex)
{
return new MyCustomError(ex.Username);
return new UserNameTakenError(ex.Username);
}

public static MyCustomError CreateErrorFrom(OtherException ex)
public static UserNameTakenError CreateErrorFrom(OtherException ex)
{
return new MyCustomError(ex.Username);
return new UserNameTakenError(ex.Username);
}

public string Message { get; }
Expand Down Expand Up @@ -621,14 +621,14 @@ public class UserNameTakenError
Message = $"The username {username} is already taken.";
}

public static MyCustomError CreateErrorFrom(UserNameTakenException ex)
public static UserNameTakenError CreateErrorFrom(UserNameTakenException ex)
{
return new MyCustomError(ex.Username);
return new UserNameTakenError(ex.Username);
}

public static MyCustomError CreateErrorFrom(OtherException ex)
public static UserNameTakenError CreateErrorFrom(OtherException ex)
{
return new MyCustomError(ex.Username);
return new UserNameTakenError(ex.Username);
}

public string Message { get; }
Expand Down Expand Up @@ -675,14 +675,14 @@ public class UserNameTakenError
Message = $"The username {username} is already taken.";
}

public static MyCustomError CreateErrorFrom(UserNameTakenException ex)
public static UserNameTakenError CreateErrorFrom(UserNameTakenException ex)
{
return new MyCustomError(ex.Username);
return new UserNameTakenError(ex.Username);
}

public static MyCustomError CreateErrorFrom(OtherException ex)
public static UserNameTakenError CreateErrorFrom(OtherException ex)
{
return new MyCustomError(ex.Username);
return new UserNameTakenError(ex.Username);
}

public string Message { get; }
Expand Down Expand Up @@ -714,14 +714,14 @@ Error factories can also be located in a dedicated class.
```csharp
public static class CreateUserErrorFactory
{
public static MyCustomErrorA CreateErrorFrom(DomainExceptionA ex)
public static UserNameTakenError CreateErrorFrom(DomainExceptionA ex)
{
return new MyCustomError();
return new UserNameTakenError();
}

public static MyCustomErrorB CreateErrorFrom(DomainExceptionB ex)
public static UserNameTakenError CreateErrorFrom(DomainExceptionB ex)
{
return new MyCustomError();
return new UserNameTakenError();
}
}

Expand All @@ -740,17 +740,17 @@ You can also use the `IPayloadErrorFactory<TError, TException>` interface, to de

```csharp
public class CreateUserErrorFactory
: IPayloadErrorFactory<MyCustomErrorA, DomainExceptionA>
, IPayloadErrorFactory<MyCustomErrorB, DomainExceptionB>
: IPayloadErrorFactory<MyCustomError, DomainExceptionA>
, IPayloadErrorFactory<MyCustomError, DomainExceptionB>
{
public MyCustomErrorA CreateErrorFrom(DomainExceptionA ex)
public MyCustomError CreateErrorFrom(DomainExceptionA ex)
{
return new MyCustomError();
return new MyCustomErrorA();
}

public MyCustomErrorB CreateErrorFrom(DomainExceptionB ex)
public MyCustomError CreateErrorFrom(DomainExceptionB ex)
{
return new MyCustomError();
return new MyCustomErrorB();
}
}

Expand Down