catch replacing useful errorInfo
- From: TronyQ <jason.t.gentry@xxxxxxxxx>
- Date: Wed, 29 Aug 2007 16:29:31 -0000
Group,
I was wondering if there was a way to not lose the error stack trace
when using the catch command. For example:
proc read_data {args} {
if {[catch {gen_data} msg]} { error $msg }
}
proc gen_data {args} {
gen_data:sub
}
proc gen_data:sub {args} {
incr i "oops"
}
If you run "gen_data", the errorInfo variable has the following
contents:
expected integer but got "oops"
while executing
"incr i "oops""
(procedure "gen_data:sub" line 3)
invoked from within
"gen_data:sub"
(procedure "gen_data" line 2)
invoked from within
"gen_data"
If you run "read_data", the errorInfo variable has the following
contents:
expected integer but got "oops"
while executing
"error $msg"
(procedure "read_data" line 3)
invoked from within
"read_data"
The "gen_data" errorInfo has much more debug information that can
point me to my mistake. However, in order to fail gracefully, I like
to use a lot of catch statements and, thus, often lose a lot of useful
debug information.
Is there a different way to accomplish what I want to do but still
keep the more verbose errorInfo in tact?
Thanks,
JG
.
- Follow-Ups:
- Re: catch replacing useful errorInfo
- From: tom.rmadilo
- Re: catch replacing useful errorInfo
- From: Donald G Porter
- Re: catch replacing useful errorInfo
- From: Gerald W. Lester
- Re: catch replacing useful errorInfo
- Prev by Date: Re: TclDevKit 3.2 & 8.4.15
- Next by Date: Re: Code lifecycle and evolution
- Previous by thread: TclDevKit 3.2 & 8.4.15
- Next by thread: Re: catch replacing useful errorInfo
- Index(es):
Relevant Pages
|