On 6/26/2014 12:23 PM, Peter Haworth wrote:
> On Thu, Jun 26, 2014 at 8:22 AM, Richard Gaskin
> wrote:
>
>> Is there a simple rule that would allow scripters to understand when
>> try-catch is necessary and when the result should be checked instead?
>>
>> If not, should there be?
>>
>> Or perhaps
On Thu, Jun 26, 2014 at 8:22 AM, Richard Gaskin
wrote:
> Is there a simple rule that would allow scripters to understand when
> try-catch is necessary and when the result should be checked instead?
>
> If not, should there be?
>
> Or perhaps better yet, could error handling be made uniform, maybe
J. Landman Gay wrote:
> On 6/24/2014, 1:02 PM, Graham Samuel wrote:
>> I get a result, "nan", and the catch doesn't fire. Why not? Maybe
>> someone can explain what the engine is doing here - or is it just an
>> obscure bug?
>
> A "catch" only triggers when there is a script error. In this case
>
Graham-
Tuesday, June 24, 2014, 11:02:56 AM, you wrote:
> I get a result, "nan", and the catch doesn't fire. Why not? Maybe
> someone can explain what the engine is doing here - or is it just an
> obscure bug?
It fires for me in either case.
To get the actual error code, change the code to
try
On Jun 24, 2014, at 11:02 AM, Graham Samuel wrote:
> If I put
>
> sqrt(-1)
>
> that fires too. But if I put
>
> (-8)^(2/3)
>
> I get a result, "nan", and the catch doesn't fire. Why not?
Gee, you'd expect sqrt(-1) and (-1)^(1/2) to evaluate the same. Apparently, the
sqrt function checks th
Hi Graham,
If I execute (-8)^(2/3) in LiveCode 6.6.1, I get "execution error at
line 7 (pow: range error (overflow)), char 17", i.e. an execution error
instead of NaN.
--
Best regards,
Mark Schonewille
Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Tw
On 6/24/2014, 1:02 PM, Graham Samuel wrote:
I get a result, "nan", and the catch doesn't fire. Why not? Maybe
someone can explain what the engine is doing here - or is it just an
obscure bug?
A "catch" only triggers when there is a script error. In this case there
is no error, "nan" is a legit
Hi
I have a bit of code that looks for input errors where the user is supposed to
write an arithmetic expression into a field. The relevant fragment looks like
this
try
put value(fld "myField") into testResult
catch
answer "oops, that's not a valid real number. Try again"
exit mouseUp