Scripterrors

From Eggdrop Wiki

(Difference between revisions)
Jump to: navigation, search
(create page)
 
(7 intermediate revisions not shown)
Line 1: Line 1:
-
Do this for every bogus script:
+
To avoid Eggdrop crashing when an error in a scriptfile occurs:
 +
Do this for every script that might raise errors while loading it:
 +
 
{{Changefile|file=eggdrop.conf|text=
{{Changefile|file=eggdrop.conf|text=
source scripts/thescript.tcl
source scripts/thescript.tcl
|newtext=
|newtext=
-
if {[catch {source scripts/thescript.tcl} err]} { putlog "Error while loading thescript.tcl: $err" }
+
if {[catch {source scripts/thescript.tcl} err]} {
 +
putlog "Error while loading thescript.tcl: $err"
 +
} else {
 +
putlog "thescript.tcl loaded without errors"
 +
}
}}
}}
 +
 +
Or for all scripts:
 +
<source lang=tcl>
 +
set scripts {
 +
    scripts/thescript1.tcl
 +
    scripts/thescript2.tcl
 +
    scripts/thescript3.tcl
 +
}
 +
foreach script $scripts {
 +
    if {[catch {source $script} err]} {
 +
        putlog "Error while loading $script: $err"
 +
    } else {
 +
        putlog "$script loaded without errors"
 +
}
 +
</source>

Current revision as of 10:44, 14 January 2018

To avoid Eggdrop crashing when an error in a scriptfile occurs: Do this for every script that might raise errors while loading it:

Open the eggdrop.conf file in your editor.

Search for

source scripts/thescript.tcl

and replace it with

if {[catch {source scripts/thescript.tcl} err]} {
	putlog "Error while loading thescript.tcl: $err"
} else {
	putlog "thescript.tcl loaded without errors"
}


Or for all scripts:

set scripts {
    scripts/thescript1.tcl
    scripts/thescript2.tcl
    scripts/thescript3.tcl
}
foreach script $scripts {
    if {[catch {source $script} err]} {
        putlog "Error while loading $script: $err"
    } else {
        putlog "$script loaded without errors"
}
Personal tools