[REBOL] Catching Web Site Access Errors Re:

2000-03-01 Thread lmecir
Title: Catching Web Site Access Errors



Hi,

you may try the following:

exists?: func [ 
{ Determines if a file or URL 
exists. Checks for invalid 
HTML pages. } target [file! 
url!] /local port comp ts][ if 
error? try 
[ port: 
make port! 
target 
query port ] [return false] if not 
port/status [return false] if port/scheme = 'HTTP 
[ ts: to string! 
target if (to string! port/url) = 
ts [ 
return true 
] comp: copy 
"http://" if port/host [append 
comp port/host] if comp = ts 
[ return 
true 
] if (append copy comp #"/") = ts 
[ return 
true 
] if port/path [append comp 
port/path] if comp = ts 
[ return 
true 
] if port/target [append comp 
port/target] if comp = ts 
[ return 
true 
] return 
false ] 
true]Regards,
 Ladislav

  - Pvodní zpráva - 
  Od: 
  [EMAIL PROTECTED] 
  
  Komu: [EMAIL PROTECTED] 
  Odesláno: 29. února 2000 19:56
  Pedmt: [REBOL] Catching Web Site 
  Access Errors
  
  I am connecting to a remote site using: 
  page: read http://www.noSuchSite.com 
  How do I catch the scenario where the site doesn't exist, with 
  no error checking I get the following: 
  Access Error: Cannot connect to www.noSuchSite.com 
  Melvin Mudgett-Price Director of 
  Development http://www.acmex.com/bio/mmp (Bio) (216) 391-7400 X207 
  acmeX.com - Acme Express, Inc. Web-enabled software / e-commerce / Web Marketing http://www.acmeX.com (216) 391-0707 
  (FAX) (216) 276-5487 (Cell) 



[REBOL] Catching Web Site Access Errors Re:

2000-02-29 Thread icimjs

Hi Melvin,

 if error? error: try [
 read http://www.does-not-exist.com
   ] [
   error: disarm :error probe error
 ]
connecting to: www.does-not-exist.com

make object! [
code: 507
type: access
id: no-connect
arg1: "www.does-not-exist.com"
arg2: none
arg3: none
near: [read http://www.does-not-exist.com]
where: none
]

At 01:56 PM 2/29/00 -0500, you wrote:
 I am connecting to a remote site using:   page: read
http://www.noSuchSite.com   How do I catch the scenario where the site
doesn't exist, with no error checking I get the following:   Access Error:
Cannot connect to www.noSuchSite.com   Melvin Mudgett-Price 
Director of Development 
http://www.acmex.com/bio/mmp (Bio) 
(216) 391-7400 X207 - Acme Express, Inc. 
Web-enabled software / e-commerce / Web Marketing  
http://www.acmeX.com 
(216) 391-0707 (FAX) 
(216) 276-5487 (Cell)

;- Elan  [: - )]