Add special exception
MODIFY
WalletWasabi/WabiSabi/Client/CoinJoinClient.cs
WalletWasabi/WabiSabi/Client/CoinJoinClient.cs
@@ -145,7 +145,7 @@ public class CoinJoinClient
{
registeredAliceClients = await CreateRegisterAndConfirmCoinsAsync(httpClient, smartCoins, roundState, cancellationToken).ConfigureAwait(false);
}
- catch (InvalidOperationException ex)
+ catch (UnexpectedRoundPhaseException ex)
{
Logger.LogInfo($"Round ({roundState.Id}): Registration phase ended by the coordinator: '{ex.Message}'.");
return true;

MODIFY
WalletWasabi/WabiSabi/Client/RoundStateAwaiter.cs
WalletWasabi/WabiSabi/Client/RoundStateAwaiter.cs
@@ -59,15 +59,15 @@ public record RoundStateAwaiter
}
}
- if (Phase is { })
+ if (Phase is { } expectedPhase)
{
- if (roundState.Phase > Phase)
+ if (roundState.Phase > expectedPhase)
{
- TaskCompletionSource.TrySetException(new InvalidOperationException($"Round {RoundId} unexpected phase change. Waiting for '{Phase}' but the round is in '{roundState.Phase}'."));
+ TaskCompletionSource.TrySetException(new UnexpectedRoundPhaseException(RoundId ?? uint256.Zero, expectedPhase, roundState.Phase));
return true;
}
- if (roundState.Phase != Phase)
+ if (roundState.Phase != expectedPhase)
{
continue;
}

ADD
WalletWasabi/WabiSabi/Client/UnexpectedRoundPhaseException.cs
+using NBitcoin;
+using System.Collections;
+using WalletWasabi.WabiSabi.Backend.Rounds;
+using WalletWasabi.WabiSabi.Models;
+
+namespace WalletWasabi.WabiSabi.Client;
+
+public class UnexpectedRoundPhaseException : Exception
+{
+ public UnexpectedRoundPhaseException(uint256 roundId, Phase expected, Phase actual)
+ {
+ RoundId = roundId;
+ Expected = expected;
+ Actual = actual;
+ }
+
+ public uint256 RoundId { get; }
+ public Phase Expected { get; }
+ public Phase Actual { get; }
+
+ public override string Message => $"Round {RoundId} unexpected phase change. Waiting for '{Expected}' but the round is in '{Actual}'.";
+}

Add special exception