diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-04-15 15:01:26 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-04-15 15:01:26 +0200 |
commit | 0ed9bf788d778eba03d65ad19cea6c0a5c432870 (patch) | |
tree | 76bde88e851095cf14949c22f8c6dee7e9e7f5f9 /data/rbot/plugins/script.rb | |
parent | 7f938d96c15a53fa42fe8e55617ff0a2c25dd00e (diff) |
script plugin: report_error() method
Diffstat (limited to 'data/rbot/plugins/script.rb')
-rw-r--r-- | data/rbot/plugins/script.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/data/rbot/plugins/script.rb b/data/rbot/plugins/script.rb index 8a3e1e84..2d730fe9 100644 --- a/data/rbot/plugins/script.rb +++ b/data/rbot/plugins/script.rb @@ -41,6 +41,12 @@ class ScriptPlugin < Plugin end end + def report_error(m, name, e) + # ed = e.backtrace.unshift(e.inspect).join(' ') + ed = e.inspect + m.reply( "Script '#{name}' crapped out :( #{ed}" ) + end + def listen( m ) name = m.message.split.first @@ -60,8 +66,7 @@ class ScriptPlugin < Plugin begin eval( code ) rescue Exception => e - m.reply( "Script '#{name}' crapped out :(" ) - m.reply( e.inspect ) + report_error(m, name, e) end } m.replied = true @@ -76,8 +81,7 @@ class ScriptPlugin < Plugin begin eval( code ) rescue Exception => e - m.reply( "Script '#{name}' crapped out :(" ) - m.reply( e.inspect ) + report_error(m, code, e) end } m.replied = true @@ -91,8 +95,7 @@ class ScriptPlugin < Plugin begin m.reply eval( code ).to_s rescue Exception => e - m.reply( "Script '#{name}' crapped out :(" ) - m.reply( e.inspect ) + report_error(m, code, e) end } m.replied = true |