mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Handle exception from OpenInBrowserTab & OpenInBrowserWindow
This commit is contained in:
parent
4bc34f64e8
commit
f6c75c2107
2 changed files with 19 additions and 4 deletions
|
|
@ -473,6 +473,7 @@
|
|||
</system:String>
|
||||
<system:String x:Key="errorTitle">Error</system:String>
|
||||
<system:String x:Key="folderOpenError">An error occurred while opening the folder. {0}</system:String>
|
||||
<system:String x:Key="browserOpenError">An error occurred while opening the url in browser. Please check your setting in Default Web Browser of general page.</system:String>
|
||||
|
||||
<!-- General Notice -->
|
||||
<system:String x:Key="pleaseWait">Please wait...</system:String>
|
||||
|
|
|
|||
|
|
@ -399,13 +399,27 @@ namespace Flow.Launcher
|
|||
|
||||
var path = browserInfo.Path == "*" ? "" : browserInfo.Path;
|
||||
|
||||
if (browserInfo.OpenInTab)
|
||||
try
|
||||
{
|
||||
uri.AbsoluteUri.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
|
||||
if (browserInfo.OpenInTab)
|
||||
{
|
||||
uri.AbsoluteUri.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
|
||||
}
|
||||
else
|
||||
{
|
||||
uri.AbsoluteUri.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
uri.AbsoluteUri.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg);
|
||||
var tabOrWindow = browserInfo.OpenInTab ? "tab" : "window";
|
||||
LogException(ClassName, $"Failed to open URL in browser {tabOrWindow}: {path}, {inPrivate ?? browserInfo.EnablePrivate}, {browserInfo.PrivateArg}", e);
|
||||
ShowMsgBox(
|
||||
GetTranslation("browserOpenError"),
|
||||
GetTranslation("errorTitle"),
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Error
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in a new issue