chiark / gitweb /
Invent and use catch_logged
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 29 Nov 2001 19:07:37 +0000 (19:07 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 29 Nov 2001 19:07:37 +0000 (19:07 +0000)
bot.tcl
irccore.tcl

diff --git a/bot.tcl b/bot.tcl
index 0929a0f3bd98c9ffaeeeb20ddaabbc727bc8d0b5..ab788e2fc4716d957e1e1ebd0311c2bc73ab5d46 100755 (executable)
--- 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
 }
 
index 4937211acb00aa638728d3c19ee82814aad1984e..4fbf639770f256909e64bc2e18f1767d705d6473 100644 (file)
@@ -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