[REBOL] problem with if error? try [block] [block]
From: dougedmunds:gma:il at: 18-Apr-2008 12:28
Hello,
I send a binary (bin_out) to a server (remote) which
is supposed to send back a reply
If the out-going binary is malformed, it causes the
server to crash.
The code below writes to a log when that happens.
(The Rebol window and Rebol console always immediately
after that).
The problem is that I can't get the second part
of the try statement (starting with [wait 2]
to work, unless there has been at least
one successful run-through of the first part
(the 'wait remote' part).
Is this a bug with try?
-- Doug Edmunds
---start---
;(connection already opened)
insert remote bin_out
if error?
try [wait remote]
[wait 2
print "Server crashed. See crash.txt"
error_msg: reform [now {Server crashed} bin_out ]
write/lines/append %crash.txt error_msg
]
;(get data from server)
bin_in: copy remote []
--- end---