Skip to content

Commit 92df021

Browse files
committed
Improve message box in app constructor
1 parent d8b07f6 commit 92df021

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Flow.Launcher/App.xaml.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public App()
4444
}
4545
catch (Exception e)
4646
{
47-
MessageBox.Show($"Cannot load setting storage: {e}");
47+
ShowErrorMsgBox("Cannot load setting storage, please check local data directory", e);
48+
return;
4849
}
4950

5051
// Configure the dependency injection container
@@ -68,7 +69,8 @@ public App()
6869
}
6970
catch (Exception e)
7071
{
71-
MessageBox.Show($"Cannot configure dependency injection container: {e}");
72+
ShowErrorMsgBox("Cannot configure dependency injection container, please open new issue in Flow.Launcher", e);
73+
return;
7274
}
7375

7476
// Initialize the public API and Settings first
@@ -79,10 +81,16 @@ public App()
7981
}
8082
catch (Exception e)
8183
{
82-
MessageBox.Show($"Cannot initialize public API and settings: {e}");
84+
ShowErrorMsgBox("Cannot initialize api and settings, please open new issue in Flow.Launcher", e);
85+
return;
8386
}
8487
}
8588

89+
private static void ShowErrorMsgBox(string caption, Exception e)
90+
{
91+
MessageBox.Show(e.ToString(), caption, MessageBoxButton.OK, MessageBoxImage.Error);
92+
}
93+
8694
[STAThread]
8795
public static void Main()
8896
{

0 commit comments

Comments
 (0)