From: Ian Jackson Date: Thu, 29 Nov 2001 19:07:37 +0000 (+0000) Subject: Invent and use catch_logged X-Git-Tag: merge-2001-10-09-tell~35 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/ircbot/commitdiff_plain/65aff3a3a7ac86da7aca85a10ab0193c935e6f61 Invent and use catch_logged --- diff --git a/bot.tcl b/bot.tcl index 0929a0f..ab788e2 100755 --- a/bot.tcl +++ b/bot.tcl @@ -18,7 +18,7 @@ proc privmsg_unlogged {prefix ischan params} { set chan [lindex $params 0] upvar #0 chan_lastactivity([irctolower $chan]) la set la [clock seconds] - catch { recordlastseen_p $prefix "talking on $chan" 1 } + catch_logged { recordlastseen_p $prefix "talking on $chan" 1 } return 1 } diff --git a/irccore.tcl b/irccore.tcl index 4937211..4fbf639 100644 --- a/irccore.tcl +++ b/irccore.tcl @@ -212,6 +212,12 @@ proc onread {args} { } } +proc catch_logged {body} { + if {[catch { uplevel 1 $body } emsg]} { + logerror "error (catch_logged): $emsg" + } +} + proc sendprivmsg {dest l} { foreach v [split $l "\n"] { sendout [expr {[ischan $dest] ? "PRIVMSG" : "NOTICE"}] $dest $v