03-25-2017, 22:42 +0100
AuthorPost
thommey  12-20-2009, 13:20   | [EGG] Redirect errors to a channel/query Jabber
(Administrator)
Member since 03/2004
62 Posts
                                                                                                                              
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
31
32
33
########

# Set the errortarget <channel> or <nick>. Set to "" to disable.
set errortarget "#chan"

# Set this to 1 if you want error backtraces to be put to the logfiles, too
set logerrors 1

########

# Only trace once
if {![info exists ::errortracer]} {
    set ::errortracer 1
    trace add variable ::errorInfo write redirecterror
}
# Because of how errors are triggered in eggdrop and tcl,
# we need to prevent doubled/tripled errors happening at once.
# I use a 2-second delay here to do that
proc redirecterror {args} {
    global errortarget logerrors lasterror errorInfo
    if {![info exists logerrors] || [info exists lasterror] && $lasterror eq $errorInfo} { return }
    if {$errortarget ne ""} {
        puthelp "PRIVMSG $errortarget :Tcl-Error backtrace:"
        foreach line [split $errorInfo \n] {
            puthelp "PRIVMSG $errortarget :$line"
        }
    }
    if {$logerrors} {
        putlog "Tcl-Error backtrace: $errorInfo"
    }
    set lasterror $errorInfo
    utimer 2 {catch {unset ::lasterror}}
}

This post was edited 5 times, last on 02-26-2014, 23:32 by thommey
CyBex  07-24-2010, 13:26   Jabber  ICQ  AOL IM  Yahoo IM  MSN  Homepage
nie da
(Administrator)

Avatar

Member since 01/2004
260 Posts
Location: Berlin
why didn't you use {args} for vars? you dont use any of them.. :)

mfG CyBex @ QuakeNet, UnderNet, EFNet, Freenode, euIRC, GameSurge & ShadowWorld - Files
Advanced options for this topic:

Ignore this topic (Do not list this topic in the "unread topics" search. You are currently not ignoring this topic.)
Hide this topic (Hidden topics are not displayed in the topics list. This topic is currently not hidden.)
Go to forum

Unclassified NewsBoard 1.5.3-d | © 2003-4 by Yves Goergen