Rename ConnectionException -> TorConnectionException.
MODIFY
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
@@ -375,7 +375,7 @@ namespace WalletWasabi.Gui.ViewModels
catch (Exception ex)
{
Logger.LogError(ex);
- NotificationHelpers.Error($"Could not get Legal Documents!{(ex is ConnectionException ? " Backend not connected. Check your internet connection!" : "")}");
+ NotificationHelpers.Error($"Could not get Legal Documents!{(ex is TorConnectionException ? " Backend not connected. Check your internet connection!" : "")}");
}
finally
{

MODIFY
WalletWasabi/CoinJoin/Client/Clients/AliceClientBase.cs
WalletWasabi/CoinJoin/Client/Clients/AliceClientBase.cs
@@ -169,7 +169,7 @@ namespace WalletWasabi.CoinJoin.Client.Clients
{
return;
}
- catch (ConnectionException) // If some internet connection issue then it'll likely time out and take it as unconfirmed.
+ catch (TorConnectionException) // If some internet connection issue then it'll likely time out and take it as unconfirmed.
{
return;
}

MODIFY
WalletWasabi/Services/WasabiSynchronizer.cs
WalletWasabi/Services/WasabiSynchronizer.cs
@@ -185,7 +185,7 @@ namespace WalletWasabi.Services
TorStatus = TorStatus.Running;
DoNotGenSocksServFail();
}
- catch (ConnectionException ex)
+ catch (TorConnectionException ex)
{
TorStatus = TorStatus.NotRunning;
BackendStatus = BackendStatus.NotConnected;
@@ -317,7 +317,7 @@ namespace WalletWasabi.Services
{
Logger.LogInfo("Wasabi Synchronizer execution was canceled.");
}
- catch (ConnectionException ex)
+ catch (TorConnectionException ex)
{
Logger.LogError(ex);
try

MODIFY
WalletWasabi/Tor/Http/TorHttpClient.cs
WalletWasabi/Tor/Http/TorHttpClient.cs
@@ -144,7 +144,7 @@ namespace WalletWasabi.Tor.Http
}
catch (SocketException ex3) when (ex3.ErrorCode == (int)SocketError.ConnectionRefused)
{
- throw new ConnectionException("Connection was refused.", ex3);
+ throw new TorConnectionException("Connection was refused.", ex3);
}
cancel.ThrowIfCancellationRequested();

DELETE
WalletWasabi/Tor/Socks5/Exceptions/ConnectionException.cs
-using System;
-
-namespace WalletWasabi.Tor.Socks5.Exceptions
-{
- public class ConnectionException : Exception
- {
- public ConnectionException(string message) : base(message)
- {
- }
-
- public ConnectionException(string message, Exception innerException) : base(message, innerException)
- {
- }
- }
-}

ADD
WalletWasabi/Tor/Socks5/Exceptions/TorConnectionException.cs
+using System;
+
+namespace WalletWasabi.Tor.Socks5.Exceptions
+{
+ public class TorConnectionException : Exception
+ {
+ public TorConnectionException(string message) : base(message)
+ {
+ }
+
+ public TorConnectionException(string message, Exception innerException) : base(message, innerException)
+ {
+ }
+ }
+}

MODIFY
WalletWasabi/Tor/Socks5/TorSocks5Client.cs
WalletWasabi/Tor/Socks5/TorSocks5Client.cs
@@ -10,7 +10,6 @@ using System.Threading.Tasks;
using WalletWasabi.Crypto.Randomness;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
-using WalletWasabi.Tor.Exceptions;
using WalletWasabi.Tor.Http;
using WalletWasabi.Tor.Socks5.Exceptions;
using WalletWasabi.Tor.Socks5.Models.Fields.ByteArrayFields;
@@ -74,7 +73,7 @@ namespace WalletWasabi.Tor.Socks5
}
catch (Exception ex) when (IsConnectionRefused(ex))
{
- throw new ConnectionException($"Could not connect to Tor SOCKSPort at {host}:{port}. Is Tor running?", ex);
+ throw new TorConnectionException($"Could not connect to Tor SOCKSPort at {host}:{port}. Is Tor running?", ex);
}
Stream = TcpClient.GetStream();
@@ -97,7 +96,7 @@ namespace WalletWasabi.Tor.Socks5
return true;
}
- catch (ConnectionException)
+ catch (TorConnectionException)
{
return false;
}
@@ -281,11 +280,11 @@ namespace WalletWasabi.Tor.Socks5
}
catch (Exception ex) when (IsConnectionRefused(ex))
{
- throw new ConnectionException($"{nameof(TorSocks5Client)} is not connected to '{RemoteEndPoint}'.", ex);
+ throw new TorConnectionException($"{nameof(TorSocks5Client)} is not connected to '{RemoteEndPoint}'.", ex);
}
if (!IsConnected)
{
- throw new ConnectionException($"{nameof(TorSocks5Client)} is not connected to '{RemoteEndPoint}'.");
+ throw new TorConnectionException($"{nameof(TorSocks5Client)} is not connected to '{RemoteEndPoint}'.");
}
}
}
@@ -368,7 +367,7 @@ namespace WalletWasabi.Tor.Socks5
if (receiveCount <= 0)
{
- throw new ConnectionException($"Not connected to Tor SOCKS5 proxy: {TorSocks5EndPoint}.");
+ throw new TorConnectionException($"Not connected to Tor SOCKS5 proxy: {TorSocks5EndPoint}.");
}
// if we could fit everything into our buffer, then return it
if (!stream.DataAvailable)
@@ -385,7 +384,7 @@ namespace WalletWasabi.Tor.Socks5
receiveCount = await stream.ReadAsync(receiveBuffer, 0, actualReceiveBufferSize, cancellationToken).ConfigureAwait(false);
if (receiveCount <= 0)
{
- throw new ConnectionException($"Not connected to Tor SOCKS5 proxy: {TorSocks5EndPoint}.");
+ throw new TorConnectionException($"Not connected to Tor SOCKS5 proxy: {TorSocks5EndPoint}.");
}
builder.Append(receiveBuffer[..receiveCount]);
}
@@ -400,7 +399,7 @@ namespace WalletWasabi.Tor.Socks5
}
catch (IOException ex)
{
- throw new ConnectionException($"{nameof(TorSocks5Client)} is not connected to {RemoteEndPoint}.", ex);
+ throw new TorConnectionException($"{nameof(TorSocks5Client)} is not connected to {RemoteEndPoint}.", ex);
}
}

Rename ConnectionException -> TorConnectionException.