From 65aff3a3a7ac86da7aca85a10ab0193c935e6f61 Mon Sep 17 00:00:00 2001 Message-Id: <65aff3a3a7ac86da7aca85a10ab0193c935e6f61.1715902440.git.mdw@distorted.org.uk> From: Mark Wooding Date: Thu, 29 Nov 2001 19:07:37 +0000 Subject: [PATCH] Invent and use catch_logged Organization: Straylight/Edgeware From: Ian Jackson --- bot.tcl | 2 +- irccore.tcl | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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 -- [mdw]