Skip to content

Commit d0b8b68

Browse files
committed
Adjust error handling when dotnet --info is called
1 parent 9b2fd8d commit d0b8b68

File tree

1 file changed

+9
-15
lines changed
  • csharp/extractor/Semmle.Extraction.CSharp.Standalone

1 file changed

+9
-15
lines changed

csharp/extractor/Semmle.Extraction.CSharp.Standalone/DotNet.cs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,16 @@ public DotNet(ProgressMonitor progressMonitor)
1818

1919
private void Info()
2020
{
21-
try
22-
{
23-
// TODO: make sure the below `dotnet` version is matching the one specified in global.json
24-
progressMonitor.RunningProcess("dotnet --info");
25-
using var proc = Process.Start("dotnet", "--info");
26-
proc.WaitForExit();
27-
var ret = proc.ExitCode;
28-
if (ret != 0)
29-
{
30-
progressMonitor.CommandFailed("dotnet", "--info", ret);
31-
throw new Exception($"dotnet --info failed with exit code {ret}.");
32-
}
33-
}
34-
catch (Exception ex)
21+
// TODO: make sure the below `dotnet` version is matching the one specified in global.json
22+
progressMonitor.RunningProcess("dotnet --info");
23+
using var proc = Process.Start("dotnet", "--info");
24+
proc.WaitForExit();
25+
var ret = proc.ExitCode;
26+
27+
if (ret != 0)
3528
{
36-
throw new Exception("dotnet --info failed.", ex);
29+
progressMonitor.CommandFailed("dotnet", "--info", ret);
30+
throw new Exception($"dotnet --info failed with exit code {ret}.");
3731
}
3832
}
3933

0 commit comments

Comments
 (0)