Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I posted a query a short while ago and had an informed answer within a couple of hours. Terrific!..."

Geography

Where in the world do Tek-Tips members come from?

How to make a tcl script running through the end if there is failure in a command in the script

tpham1002002 (TechnicalUser)
3 Jul 12 16:15
I am creating a TCL script namely test.tcl in that script I use many built-in Tcl commands to test a tool in batch mode. This is contents of the script, for example

a $myname
b $last $first
c $occupation

where a, b and c are Tcl built-in commands
somehow the variables are passing incorrectly and cause one of the commands failure (for example command b will fail if $first is empty string) then it will stops the script running through the end.
I am thinking a way to keep the test.tcl script running through the end in that case and report the error if there is any but I dont know how to do that.
I guess I need to have a check in each command to capture the error if it fails but it is beyond my knowledge since I just learn Tcl.
I would like to have your help to help me to resolve the issue.
Thanks a lot
Tony
fhutt (Programmer)
3 Jul 12 20:59
Posttpham1002002 I've had this problem too. The 'catch' procedure can be used to catch errors. The way I've used is:
set errorval {}
catch {tclscripts} errorval
Here, if tclscript does not generate an error the errorval variable will be blank. If there is an error the errorval will contain some script. The program will just continue and you can interrogate the variable an any time.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close