Skip to content

Commit 4bc34f6

Browse files
committed
Re-throw the exception if we cannot open the URL in the default browser
1 parent 32ae3a1 commit 4bc34f6

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,18 @@ public static void OpenInBrowserWindow(this string url, string browserPath = "",
6868
// This error may be thrown if browser path is incorrect
6969
catch (Win32Exception)
7070
{
71-
Process.Start(new ProcessStartInfo
71+
try
7272
{
73-
FileName = url, UseShellExecute = true
74-
});
73+
Process.Start(new ProcessStartInfo
74+
{
75+
FileName = url,
76+
UseShellExecute = true
77+
});
78+
}
79+
catch
80+
{
81+
throw; // Re-throw the exception if we cannot open the URL in the default browser
82+
}
7583
}
7684
}
7785

@@ -103,10 +111,18 @@ public static void OpenInBrowserTab(this string url, string browserPath = "", bo
103111
// This error may be thrown if browser path is incorrect
104112
catch (Win32Exception)
105113
{
106-
Process.Start(new ProcessStartInfo
114+
try
107115
{
108-
FileName = url, UseShellExecute = true
109-
});
116+
Process.Start(new ProcessStartInfo
117+
{
118+
FileName = url,
119+
UseShellExecute = true
120+
});
121+
}
122+
catch
123+
{
124+
throw; // Re-throw the exception if we cannot open the URL in the default browser
125+
}
110126
}
111127
}
112128
}

0 commit comments

Comments
 (0)