# HG changeset patch # User Matthew Wild # Date 1261530013 0 # Node ID 1eaa469140e901083276f791c251e9b2fd905572 # Parent d1a9fb6495c6b17d7d3b5396977f8cc070969a05 plugins.ping: Update to handle errors passed from Verse diff -r d1a9fb6495c6 -r 1eaa469140e9 plugins/ping.lua --- a/plugins/ping.lua Tue Dec 22 05:10:08 2009 +0000 +++ b/plugins/ping.lua Wed Dec 23 01:00:13 2009 +0000 @@ -4,8 +4,12 @@ bot:hook("commands/ping", function (command) local jid = command.param; if jid then - bot.stream:ping(jid, function (time) - command:reply(string.format("Pong from %s in %0.3f seconds", jid, time)); + bot.stream:ping(jid, function (time, jid, error) + if time then + command:reply(string.format("Pong from %s in %0.3f seconds", jid, time)); + else + command:reply("Ping failed ("..(error.condition or "unknown reason")..")"..(error.text and (": "..error.text) or "")); + end end); return true; end