Skip to content

Commit

Permalink
Merge pull request #121 from CodebreakerApp/118-backendmodelupdates
Browse files Browse the repository at this point in the history
118 update backend models
  • Loading branch information
christiannagel authored Dec 26, 2023
2 parents 1627596 + a1aae20 commit 4392afc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/createnuget-withbuildnumber.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

steps:
- name: Checkout to the branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch-name }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
See https://github.com/codebreakerapp for more information on the complete solution.
</Description>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<PackageIcon>codebreaker.jpeg</PackageIcon>
<PackageIcon>codebreaker.jpeg</PackageIcon>
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@ public static void ThrowIfNull([NotNull] Game? game)
}
}

public static void ThrowIfEnded(Game game)
public static void ThrowIfUnexpectedGameType(Game game, string gameType)
{
if (game.Ended())
if (game.GameType != gameType)
{
throw new CodebreakerException("Game is not active") { Code = CodebreakerExceptionCodes.GameNotActive };
throw new CodebreakerException("Game type not expected") { Code = CodebreakerExceptionCodes.UnexpectedGameType };
}
}

[DoesNotReturn]
public static void ThrowUpdateFailed(Game game)
public static void ThrowIfEnded(Game game)
{
throw new CodebreakerException("Game update failed") { Code = CodebreakerExceptionCodes.GameUpdateFailed };
if (game.Ended())
{
throw new CodebreakerException("Game is not active") { Code = CodebreakerExceptionCodes.GameNotActive };
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
public class CodebreakerExceptionCodes
{
public const string InvalidGameType = nameof(InvalidGameType);
public const string UnexpectedGameType = nameof(UnexpectedGameType);
public const string GameNotFound = nameof(GameNotFound);
public const string GameNotActive = nameof(GameNotActive);
public const string GameUpdateFailed = nameof(GameUpdateFailed);
Expand Down

0 comments on commit 4392afc

Please sign in to comment.