@@ -37,7 +37,7 @@ public static class PluginManager
37
37
38
38
private static PluginsSettings Settings ;
39
39
private static List < PluginMetadata > _metadatas ;
40
- private static List < string > _modifiedPlugins = new ( ) ;
40
+ private static readonly List < string > _modifiedPlugins = new ( ) ;
41
41
42
42
/// <summary>
43
43
/// Directories that will hold Flow Launcher plugin directory
@@ -61,10 +61,17 @@ private static void DeletePythonBinding()
61
61
/// </summary>
62
62
public static void Save ( )
63
63
{
64
- foreach ( var plugin in AllPlugins )
64
+ foreach ( var pluginPair in AllPlugins )
65
65
{
66
- var savable = plugin . Plugin as ISavable ;
67
- savable ? . Save ( ) ;
66
+ var savable = pluginPair . Plugin as ISavable ;
67
+ try
68
+ {
69
+ savable ? . Save ( ) ;
70
+ }
71
+ catch ( Exception e )
72
+ {
73
+ API . LogException ( ClassName , $ "Failed to save plugin { pluginPair . Metadata . Name } ", e ) ;
74
+ }
68
75
}
69
76
70
77
API . SavePluginSettings ( ) ;
@@ -81,14 +88,21 @@ public static async ValueTask DisposePluginsAsync()
81
88
82
89
private static async Task DisposePluginAsync ( PluginPair pluginPair )
83
90
{
84
- switch ( pluginPair . Plugin )
91
+ try
92
+ {
93
+ switch ( pluginPair . Plugin )
94
+ {
95
+ case IDisposable disposable :
96
+ disposable . Dispose ( ) ;
97
+ break ;
98
+ case IAsyncDisposable asyncDisposable :
99
+ await asyncDisposable . DisposeAsync ( ) ;
100
+ break ;
101
+ }
102
+ }
103
+ catch ( Exception e )
85
104
{
86
- case IDisposable disposable :
87
- disposable . Dispose ( ) ;
88
- break ;
89
- case IAsyncDisposable asyncDisposable :
90
- await asyncDisposable . DisposeAsync ( ) ;
91
- break ;
105
+ API . LogException ( ClassName , $ "Failed to dispose plugin { pluginPair . Metadata . Name } ", e ) ;
92
106
}
93
107
}
94
108
@@ -292,7 +306,7 @@ public static async Task<List<Result>> QueryForPluginAsync(PluginPair pair, Quer
292
306
{
293
307
Title = $ "{ metadata . Name } : Failed to respond!",
294
308
SubTitle = "Select this result for more info" ,
295
- IcoPath = Flow . Launcher . Infrastructure . Constant . ErrorIcon ,
309
+ IcoPath = Constant . ErrorIcon ,
296
310
PluginDirectory = metadata . PluginDirectory ,
297
311
ActionKeywordAssigned = query . ActionKeyword ,
298
312
PluginID = metadata . ID ,
@@ -369,8 +383,8 @@ public static bool ActionKeywordRegistered(string actionKeyword)
369
383
{
370
384
// this method is only checking for action keywords (defined as not '*') registration
371
385
// hence the actionKeyword != Query.GlobalPluginWildcardSign logic
372
- return actionKeyword != Query . GlobalPluginWildcardSign
373
- && NonGlobalPlugins . ContainsKey ( actionKeyword ) ;
386
+ return actionKeyword != Query . GlobalPluginWildcardSign
387
+ && NonGlobalPlugins . ContainsKey ( actionKeyword ) ;
374
388
}
375
389
376
390
/// <summary>
0 commit comments