Fix RCS1236

This commit is contained in:
RoosterDragon
2023-08-11 19:47:48 +01:00
committed by Gustas
parent 498c6e3d8b
commit 9a3c39878d
3 changed files with 7 additions and 8 deletions

View File

@@ -1136,5 +1136,9 @@ dotnet_diagnostic.RCS1233.severity = warning
# Optimize method call.
dotnet_diagnostic.RCS1235.severity = warning
# Use exception filter.
dotnet_diagnostic.RCS1236.severity = warning
# Use 'for' statement instead of 'while' statement.
dotnet_diagnostic.RCS1239.severity = warning

View File

@@ -109,10 +109,8 @@ namespace OpenRA.FileSystem
Mount(package, explicitName);
}
catch
catch when (optional)
{
if (!optional)
throw;
}
}

View File

@@ -248,12 +248,9 @@ namespace OpenRA.Server
{
listener.Server.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, 1);
}
catch (Exception ex)
catch (Exception ex) when (ex is SocketException || ex is ArgumentException)
{
if (ex is SocketException || ex is ArgumentException)
Log.Write("server", $"Failed to set socket option on {endpoint}: {ex.Message}");
else
throw;
Log.Write("server", $"Failed to set socket option on {endpoint}: {ex.Message}");
}
listener.Start();