lib/plugins/pluginmanager.rb in rsence-pre-2.1.0.9 vs lib/plugins/pluginmanager.rb in rsence-pre-2.1.0.10
- old
+ new
@@ -140,20 +140,27 @@
return false
end
alias run_plugin call
# Prettier error handling.
+ @@prev_errors = []
def plugin_error( e, err_location, err_location_descr, eval_repl=false )
err_msg = [
"*"*40,
err_location,
err_location_descr,
"#{e.class.to_s}, #{e.message}",
"Backtrace:",
"\t"+e.backtrace.join("\n\t"),
"*"*40
].join("\n")+"\n"
+ error_say = "Error! #{err_location_descr.capitalize}. #{e.class.to_s}, #{e.message}?"
+ unless @@prev_errors.include?( error_say )
+ @@prev_errors.push( error_say )
+ say error_say
+ end
+ @@prev_errors.shift if @@prev_errors.length > 10
if eval_repl
puts
puts "plugin: #{eval_repl}"
puts
err_msg = err_msg.gsub(/^\t\(eval\)\:/s,"\t#{eval_repl}:")
@@ -514,10 +521,10 @@
def say( message )
puts message
if RSence.args[:say]
Thread.new do
Thread.pass
- system(%{say "#{message.gsub('"','')}"})
+ system(%{say "#{message.gsub('"',"'").gsub('`',"'")}"})
end
end
end
# Checks for changed plugin bundles and unloads/loads/reloads them accordingly.