Re: catch replacing useful errorInfo
- From: Donald G Porter <dgp@xxxxxxxx>
- Date: Wed, 29 Aug 2007 12:44:20 -0400
TronyQ wrote:
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 }
}
The best answer requires Tcl 8.5:
package require Tcl 8.5
proc read_data {args} {
if {[catch {gen_data} msg options]} {
return -options $options $msg
}
}
If you need to support Tcl 8.4 (or earlier):
package require Tcl 8.0
proc read_data {args} {
if {[catch {gen_data} msg]} {
error $msg $::errorInfo $::errorCode
}
}
DGP
.
- Follow-Ups:
- Re: catch replacing useful errorInfo
- From: Bryan Oakley
- Re: catch replacing useful errorInfo
- References:
- catch replacing useful errorInfo
- From: TronyQ
- catch replacing useful errorInfo
- Prev by Date: Re: catch replacing useful errorInfo
- Next by Date: WebServicesForTcl
- Previous by thread: Re: catch replacing useful errorInfo
- Next by thread: Re: catch replacing useful errorInfo
- Index(es):
Relevant Pages
|