Log exception

This commit is contained in:
Jack251970 2025-09-15 21:46:03 +08:00
parent 0355993b00
commit 18c8a04cbc

View file

@ -15,6 +15,8 @@ namespace Flow.Launcher.ViewModel
{ {
public partial class PluginViewModel : BaseModel public partial class PluginViewModel : BaseModel
{ {
private static readonly string ClassName = nameof(PluginViewModel);
private static readonly Settings Settings = Ioc.Default.GetRequiredService<Settings>(); private static readonly Settings Settings = Ioc.Default.GetRequiredService<Settings>();
private readonly PluginPair _pluginPair; private readonly PluginPair _pluginPair;
@ -148,6 +150,10 @@ namespace Flow.Launcher.ViewModel
} }
catch (Exception e) catch (Exception e)
{ {
// Log exception
App.API.LogException(ClassName, $"Failed to create setting panel for {pair.Metadata.Name}", e);
// Show error message in UI
var errorMsg = string.Format(App.API.GetTranslation("errorCreatingSettingPanel"), var errorMsg = string.Format(App.API.GetTranslation("errorCreatingSettingPanel"),
pair.Metadata.Name, Environment.NewLine, e.Message); pair.Metadata.Name, Environment.NewLine, e.Message);
var grid = new Grid() var grid = new Grid()