@@ -50,6 +50,8 @@ pub struct PluginManager {
5050 vendored_plugin_dir : PathBuf ,
5151 pub ( crate ) installed_plugin_dir : PathBuf ,
5252 dev_mode : bool ,
53+ /// Errors from plugin initialization, retrievable once via `take_init_errors`.
54+ init_errors : Arc < Mutex < Vec < ( String , String ) > > > ,
5355}
5456
5557/// Callback for plugin initialization events (e.g., toast notifications)
@@ -93,6 +95,7 @@ impl PluginManager {
9395 vendored_plugin_dir,
9496 installed_plugin_dir,
9597 dev_mode,
98+ init_errors : Default :: default ( ) ,
9699 } ;
97100
98101 // Forward events to subscribers
@@ -183,17 +186,21 @@ impl PluginManager {
183186
184187 let init_errors = plugin_manager. initialize_all_plugins ( plugins, plugin_context) . await ;
185188 if !init_errors. is_empty ( ) {
186- let joined = init_errors
187- . into_iter ( )
188- . map ( |( dir, err) | format ! ( "{dir}: {err}" ) )
189- . collect :: < Vec < _ > > ( )
190- . join ( "; " ) ;
191- return Err ( PluginErr ( format ! ( "Failed to initialize plugin(s): {joined}" ) ) ) ;
189+ for ( dir, err) in & init_errors {
190+ warn ! ( "Plugin failed to initialize: {dir}: {err}" ) ;
191+ }
192+ * plugin_manager. init_errors . lock ( ) . await = init_errors;
192193 }
193194
194195 Ok ( plugin_manager)
195196 }
196197
198+ /// Take any initialization errors, clearing them from the manager.
199+ /// Returns a list of `(plugin_directory, error_message)` pairs.
200+ pub async fn take_init_errors ( & self ) -> Vec < ( String , String ) > {
201+ std:: mem:: take ( & mut * self . init_errors . lock ( ) . await )
202+ }
203+
197204 /// Get the vendored plugin directory path (resolves dev mode path if applicable)
198205 pub fn get_plugins_dir ( & self ) -> PathBuf {
199206 if self . dev_mode {
0 commit comments