Home > Archive > Tcl > June 2006 > Argggh, oh the madness....
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Argggh, oh the madness....
|
|
| jerry.levan@gmail.com 2006-06-25, 7:06 pm |
| I was recently editing a tcl program and decided I needed to trap a
possible error. So I wrote:
try:
exec blah blah blah
except: pass
I did not discover the problem for a while because the proc containing
the above evil depended on the underlying machine state....
I took a couple of moments to figure out what was happening ;(
Birthday 68 is fast approaching, maybe it is time to watch the cracks
grow in the driveway....
Jerry
| |
| stephanearnold@yahoo.fr 2006-06-25, 7:06 pm |
|
jerry.levan@gmail.com a =E9crit :
> I was recently editing a tcl program and decided I needed to trap a
> possible error. So I wrote:
>
> try:
> exec blah blah blah
> except: pass
>
try, except and pass are Python keywords (and probably keywords
in many other languages)
In tcl, you would have written :
catch {exec blah blah blah}
If you did care about the error message, you can test the result
of [catch] : 1 if an error has occured, 0 otherwise.
It looks like :
if {[catch {exec blah blah blah} msg]} {
puts "Error : $msg"
... <error handling> ...
}
# continue normal script execution
Regards,
St=E9phane
|
|
|
|
|