01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
bind pub n ".tcl" tcldebug:tcl
proc tcldebug:tcl {nick host hand chan text} {
putcmdlog "!tcl: $nick $host $hand $chan $text"
set start [clock clicks]
set errnum [catch {eval $text} error]
set end [clock clicks]
if {$error==""} {set error "<empty string>"}
switch -- $errnum {
0 {if {$error=="<empty string>"} {set error "OK"} {set error "OK: $error"}}
4 {set error "continue: $error"}
3 {set error "break: $error"}
2 {set error "return: $error"}
1 {set error "error: $error"}
default {set error "$errnum: $error"}
}
set error "$error - [expr {($end-$start)/1000.0}] ms"
set error [split $error "\n"]
foreach line $error { putserv "PRIVMSG $chan :$line" }
}
bind pub n ".tclerror" tcldebug:error
proc tcldebug:error {nick host hand chan text} {
foreach line [split $::errorInfo \n] {
puthelp "PRIVMSG $chan :$line"
}
}
putlog "tcldebug loaded, (c) never - sometime updated by c*bex :)"
|