Hi,All.
Is there a way I can use an error checking function coded
problematically like this:
proc pooka {P pat {L1 ""} } {
set bdy [info body $P]
set i 0
foreach line [split $bdy "\n"] {
set i [incr i]
if {[regexp ".*(err..)" $line all m1 || [regexp ".*(err..).*" $line all m1]} {
if {[lsearch $L1 $m1] == 0} {
uplevel {puts [lindex $L1 [lsearch $L1 $m1]]}
}
} else {
puts "No poss match on line: $i."
}
}
return
}
Please forgive the cramped style here:
Where P is the calling proc's name, pat, is the pattern
(err*,in this case), and L1 would be [info locals err*].
The goal (which is impossible for me to figure out) is
how to use the locally derived variables from the error
matching procedure in the uplevel caller to get the exact error messages associated with the found errors.
An example:
Given the following:
proc bogus {} {
catch {puts "$foo"} err_1
catch {puts "$bar"} err_2
catch {puts "$foo$bar"} err_3
pooka bogus "err" [info locals err*]
return
}
I can get the lines and corroboration of the error names,
but not the exact error names to pass back to the caller
so I can access the error descriptions.
Is there an established way of doing this, or any way
at all to approximate this?
THANK YOU
MMD
Is there a way I can use an error checking function coded
problematically like this:
proc pooka {P pat {L1 ""} } {
set bdy [info body $P]
set i 0
foreach line [split $bdy "\n"] {
set i [incr i]
if {[regexp ".*(err..)" $line all m1 || [regexp ".*(err..).*" $line all m1]} {
if {[lsearch $L1 $m1] == 0} {
uplevel {puts [lindex $L1 [lsearch $L1 $m1]]}
}
} else {
puts "No poss match on line: $i."
}
}
return
}
Please forgive the cramped style here:
Where P is the calling proc's name, pat, is the pattern
(err*,in this case), and L1 would be [info locals err*].
The goal (which is impossible for me to figure out) is
how to use the locally derived variables from the error
matching procedure in the uplevel caller to get the exact error messages associated with the found errors.
An example:
Given the following:
proc bogus {} {
catch {puts "$foo"} err_1
catch {puts "$bar"} err_2
catch {puts "$foo$bar"} err_3
pooka bogus "err" [info locals err*]
return
}
I can get the lines and corroboration of the error names,
but not the exact error names to pass back to the caller
so I can access the error descriptions.
Is there an established way of doing this, or any way
at all to approximate this?
THANK YOU
MMD