Method: Ruber::Application#safe_load_plugins
- Defined in:
- lib/ruber/application/application.rb
#safe_load_plugins(plugins, silent = false, dirs = nil) {|pso, ex| ... } ⇒ Boolen
Loads plugins handling the exceptions they may raise in the meanwhile
It is a wrapper around ComponentManager#load_plugins.
If it’s given a block, it simply calls ComponentManager#load_plugins passing it the block.
If no block is given, the behaviour in case of an exception depends on the silent argument:
-
if true, then the error will be silently ignored and the component manager will go on loading the remaining plugins. Errors caused by those will be ignored as well
-
if false, the user will be shown a ComponentLoadingErrorDialog. According to what the user chooses in the dialog, the component manager will behave in a different way, as described in ComponentManager#load_plugins
Note: this method doesn’t attempt to handle exceptions raised while computing or sorting dependencies.
246 247 248 249 250 251 252 253 |
# File 'lib/ruber/application/application.rb', line 246 def safe_load_plugins plugins, silent = false, dirs = nil, &blk if blk.nil? and silent then blk = proc{|_pl, _e| :silent} elsif blk.nil? blk = Proc.new{|pl, e| ComponentLoadingErrorDialog.new(pl.name, e, nil).exec} end @components.load_plugins plugins, dirs || @plugin_dirs, &blk end |