diff --git a/src/GmRelay.Shared/Features/Sessions/CreateSession/CreateSessionHandler.cs b/src/GmRelay.Shared/Features/Sessions/CreateSession/CreateSessionHandler.cs index 4f5d9b8..5cb7c32 100644 --- a/src/GmRelay.Shared/Features/Sessions/CreateSession/CreateSessionHandler.cs +++ b/src/GmRelay.Shared/Features/Sessions/CreateSession/CreateSessionHandler.cs @@ -16,6 +16,7 @@ public sealed class CreateSessionHandler( await using var connection = await dataSource.OpenConnectionAsync(ct); await using var transaction = await connection.BeginTransactionAsync(ct); + var transactionCommitted = false; try { var platform = command.User.Platform.ToString(); @@ -130,7 +131,7 @@ public sealed class CreateSessionHandler( ScheduledAt = scheduledAt, Status = SessionStatus.Planned, MaxPlayers = command.MaxPlayers, - System = command.System, + System = command.System?.ToString(), command.Description, command.Format, DurationMinutes = command.DurationMinutes, @@ -142,6 +143,7 @@ public sealed class CreateSessionHandler( } await transaction.CommitAsync(ct); + transactionCommitted = true; var view = SessionBatchViewBuilder.Build(command.Title, sessions, Array.Empty()); @@ -155,7 +157,10 @@ public sealed class CreateSessionHandler( } catch { - await transaction.RollbackAsync(ct); + if (!transactionCommitted) + { + await transaction.RollbackAsync(ct); + } throw; } }