Error fuzzy logic
[1/3] from: ptretter::charter::net at: 26-Aug-2001 8:10
Anyone ever have problems with the error? logic checking. The following for example:
-------------------------------------------------------------
if connected? [
if error? error: try [send [ptretter--charter--net] read %log.txt][error: disarm error]
]
-------------------------------------------------------------
my fix to the problem at this point was to build a function for this process - here is
the complete section of code:
forever [
wait 60
rtime: now/time
if rtime > (ctime + 1:00) [
ctime: now/time
if connected? [if error? error: does [try [send [paul--tretter--charter--net] read %log.txt]][
error: disarm error
save %errorlog.txt mold error ]
]
]
]
Just curious if anyone knows whether there actually is a bug with the Try function or
if its an error with the Error? logic! datatype. The second example when putting 'Try
into a function appears to work. The other one did but would crash often giving the
message that "error has no value".
Paul Tretter
[2/3] from: fsievert:uos at: 26-Aug-2001 15:34
> -------------------------------------------------------------
>
> if connected? [
> if error? error: try [send [ptretter--charter--net] read %log.txt][error: disarm error]
> ]
>
> -------------------------------------------------------------
The problem ist not the "error?", but the "error:"
Send will, when it does not fail, return "null" and this causes the "needs
a value" problem when trying to set the word "error:". The sollution:
if error? set/any 'error: try [....]
set/any allowes to set null to values, too.
An other sollution would be:
if error? error: try [.... none]
Your example looks not like it will send the email. Because you are
producing a function and check it, if it is an error. This is not true,
because function! <> error! . So you will not run the if-body
[3/3] from: john:thousand-hills at: 26-Aug-2001 8:52
Paul:
I have noticed that there is a difference in most of the logical functions
including IF and EITHER than one might be used to. I simply consider any
options until I make it work -then I write my own FUNCTION that makes sense
to me.
You might call that an error, I'm impressed with the logic of writing my
own functions -it works for me.
The answer is in testing the code as you go. John
At 08:10 AM 8/26/2001 -0500, you wrote: