Skip to content

Commit

Permalink
Fix RCS1236
Browse files Browse the repository at this point in the history
  • Loading branch information
RoosterDragon authored and PunkPun committed Nov 10, 2023
1 parent 498c6e3 commit 9a3c398
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

4 changes: 1 addition & 3 deletions OpenRA.Game/FileSystem/FileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,8 @@ public void Mount(string name, string explicitName = null)

Mount(package, explicitName);
}
catch
catch when (optional)
{
if (!optional)
throw;
}
}

Expand Down
7 changes: 2 additions & 5 deletions OpenRA.Game/Server/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,9 @@ public Server(List<IPEndPoint> endpoints, ServerSettings settings, ModData modDa
{
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();
Expand Down

0 comments on commit 9a3c398

Please sign in to comment.