[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tkined
Subject:    Re: get http
From:       Juergen Schoenwaelder <schoenw () cs ! utwente ! nl>
Date:       1996-05-28 19:03:40
[Download RAW message or body]


colin@sobek.adone.com wrote:

   I am using the http command get http://url in an function.  I found that if 
   there is no page at the requested url, http will force a break out of the 
   function.  Do you know why?

The http command returns a Tcl error if there is an HTTP error. Thats
why the proc stop. You should use the catch command to check for HTTP
errors:

	if {[catch {http get $url $file} header]} {
	    puts stderr "http get error: $header"
	    return
	}

This makes the code a bit more difficult to read. I think that Tcl
should have a more powerful error handling mechanism which allows to
define more generic error handlers. However, this seems not the be at
the top of Johns todo list.

							Juergen

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic