Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Catching net errors

 [1/6] from: fantam:mailandnews at: 14-Jan-2001 21:55


Hello all, How do one catch an error when writing a file to a ftp server. Following the docs, this should be: disarm err: try [write ftp://blahblah read blahblah] The problem is that write does not return a value on success. So the script itself results in an error, saying that 'err needs a value. Thansk in advance.

 [2/6] from: lmecir:mbox:vol:cz at: 14-Jan-2001 22:46


A comfortable solution can be:
>> gd-try [print 1 / 0] [print mold disarm last-error]
make object! [ code: 400 type: 'math id: 'zero-divide arg1: none arg2: none arg3: none near: [print 1 / 0] where: 'gd-try ]
>> gd-try [print 1 / 1] [print mold disarm last-error]
1 The source of the function: gd-try: function [ {A Goal Directed version of the TRY native.} [throw] block [block!] error-handler [block!] ] [result] [ either error? set/any 'result try block [ error? last-error: :result do error-handler ] [ get/any 'result ] ]

 [3/6] from: rebol:techscribe at: 14-Jan-2001 14:37


Hi Fantam, the simple way is to use set/any if error? set/any 'err try [ ...] [ print mold disarm err ] Fantam wrote:

 [4/6] from: danec:thevision at: 30-Mar-2001 12:29


Greetings, If I attempt to read from a web page that does not exist, ie: dump: read http://www.foobarfoo.com/ Rebol stops execution of the code and reports: ** Access Error: Cannot connect to www.foobarfoo.com ** Where: open-proto ** Near: read http://www.foobarfoo.com How do I catch this error and continue execution? -- Dane Carlson

 [5/6] from: ryan:christiansen:intellisol at: 30-Mar-2001 14:56


use 'try, as follows... foreach url-to-read url-database [ if error? try [dump: read http://www.foobarfoo.com/][next url-database] ]
>If I attempt to read from a web page that does not exist, ie: > dump: read http://www.foobarfoo.com/
<<quoted lines omitted: 3>>
> ** Near: read http://www.foobarfoo.com >How do I catch this error and continue execution?
Ryan C. Christiansen Web Developer Intellisol International 4733 Amber Valley Parkway Fargo, ND 58104 701-235-3390 ext. 6671 FAX: 701-235-9940 http://www.intellisol.com Global Leader in People Performance Software _____________________________________ Confidentiality Notice This message may contain privileged and confidential information. If you think, for any reason, that this message may have been addressed to you in error, you must not disseminate, copy or take any action in reliance on it, and we would ask you to notify us immediately by return email to [ryan--christiansen--intellisol--com]

 [6/6] from: danec:thevision at: 30-Mar-2001 13:15


Thanks a million. Shortly after posting my question I figured out this method: either error? dump: try [read url ][bad: bad + 1] [ good: good + 1] -- Dane Carlson

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted