Re: get http

Juergen Schoenwaelder (schoenw@cs.utwente.nl)
Tue, 28 May 1996 19:03:40 +0200

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