[REBOL] Re(4): REBOL/View for commercial products -renaming
From: arolls:bigpond:au at: 14-Dec-2000 16:27
Sascha,
You should only attempt to 'disarm the result of 'try
if it is an error!
err: try [code]
if error? err [
err: disarm err
probe err
]
If code is fine, then its result is returned, which
is not of type error!
If the code has a problem, then it returns a value
of type error!, *then* we disarm it.
Try disarming a non-error value such as 1.
>> disarm 1
** Script Error: disarm expected error argument of type: error.
** Where: disarm 1
Ooops. But 1 is a possible value that try might return.
(The final value of the code might be 1).
> so, also i have ntfs on D: NT4.0 sp4
> it's succeccfull with overwrite
> but no error-object returned as here:
> >> list-dir
> babk_2 bak/ bak_2/ feedback.r nntp.r public/
> rebol.r rebx.exe user.r
> >> owrite_err: disarm try [rename %rebx.exe %rebol.exe]
> ** Script Error: disarm expected error argument of type: error.
> ** Where: owrite_err: disarm try [rename %rebx.exe %rebol.exe]
Ok, disarm failed because it didn't get an error.
That's because rename was successful.
So it should be:
>> owrite_err: try [rename %rebx.exe %rebol.exe]
>> if error? owrite_err [probe owrite_err: disarm owrite_err]
Anton.