Re: is this a bug?
Re: is this a bug?
- Subject: Re: is this a bug?
- From: has <email@hidden>
- Date: Tue, 6 Aug 2002 14:06:59 +0100
Mr Tea wrote:
>
> set theString to "12345678"
>
> theString's character 9 is in "1234567890"
>
> --> Error: Can't make character 9 of "12345678" into a string.
>
>
>
> Anyone care to confirm the second case? Looks like a recent bug to me
>
>
This is not entirely illogical, surely.
>
>
You demonstrated in your first case that AppleScript, reasonably enough,
>
can't get character 9 of "12345678", so the error in the second case equates
>
to 'Can't make [something I can't get] into a string'. The script hit a
>
wall, and simply reported the fact.
Yes, unfortunately it was the wrong fact.:) It can't make character 9 into
a string, because character 9 doesn't exist. Therefore, it should have
reported that character 9 doesn't exist. Grrr; a million "NSBlahBlahErrors"
upon its miserable head...
>
Out of interest, what would you have expected: a 'false' result with no
>
error, or the same error as your first example generated?
Same as first, which (as C Nebel confirms) is what AS used to do.
This sort fo thing becomes a real problem when you try to implement robust
error trapping, eg:
try
set char to theString's character x
on error number -1728
--handle "can't get..." error only here
end try
Sure you can do:
try
set char to theString's character x
on error
--handle error here
end try
but this is really far too vague; if the error was caused by something else
then all sorts of unpredictable things could happen as a result. Robust,
comprehensive error trapping ought to be the norm, not the exception.
Cheers,
has
--
(My email address has changed from <email@hidden> to
<email@hidden>. Please update your address books accordingly.)
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.