printing caught error messages 
Author Message
 printing caught error messages

I'm writing an Expect script, and I want to print the tcl error that is
associated with catching an error. My code looks like this:

procedure foo{
  ..something in here may produce an error...

Quote:
}

if { [catch {foo}] }  {
  ..I want to print the error that occurred in foo..

Quote:
}

How can I print the error that was caught?


Tue, 04 Apr 2006 22:44:34 GMT  
 printing caught error messages

                        .
                        .
                        .

Quote:
>if { [catch {foo}] }  {
>  ..I want to print the error that occurred in foo..
>}

>How can I print the error that was caught?

  if [catch foo error] {
    puts "'$error' is the error."
  }
--


Business:  http://www.Phaseit.net



Tue, 04 Apr 2006 23:18:21 GMT  
 printing caught error messages

Quote:

>  procedure foo{
>    ..something in here may produce an error...
>  }

>  if { [catch {foo}] }  {
>    ..I want to print the error that occurred in foo..
>  }

    if {[catch foo result] != 0} {
        # error message from foo is in $result
    } else {
        # returned value from successful foo call is in $result
    }

See http://wiki.tcl.tk/catch and http://wiki.tcl.tk/exec

--
Glenn Jackman
NCF Sysadmin



Tue, 04 Apr 2006 23:15:59 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. CATCH and error messages.

2. catching error message

3. Can't catch error messages

4. catching error messages like in c++ available?

5. execs and catching error messages

6. custom error handler doesn't catch errors

7. VW : Catching messages...

8. catch netware messages in dos-box with CA Tools III

9. Catching bus contention message within nc-sim

10. Catching bus contention message within nc-sim

11. can't suppress or catch runtime warning messages issued by IMSL library

12. python win32 extensions: catching messages sent by win32api.PostThreadMessage

 

 
Powered by phpBB® Forum Software