Skip to content

Commit

Permalink
Update mutations.md (#5598)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Staib <michael@chillicream.com>
  • Loading branch information
sarvasana and michaelstaib committed Dec 12, 2022
1 parent 86efd66 commit e038e9e
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions website/src/docs/hotchocolate/v13/defining-a-schema/mutations.md
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

0 comments on commit e038e9e

Please sign in to comment.