The .Item property is a bit misleading.  Speculation: Seems there may
be an Item defined for all classes (whether you can see them or not).
It may be more related to a "reserved word" problem.

If you change the "THIS.Item(1)" to "THIS.xItem(1)", the TRY/CATCH
code works as expected.

Fred



On Fri, Dec 10, 2010 at 2:00 PM, Steve Ellenoff <[email protected]> wrote:
> The following code snippet seems to suggest a bug in Try Catch
> handling when accessing a collection's Item property with an invalid
> index argument.
> Can someone confirm as a bug or explain it to me? The help file is
> making me confused.
>
> I was under the impression the try catch ALWAYS has priority over any
> class' Error Method handler..
>
> clear
> x = CREATEOBJECT("test")
> x.method1()
> x.method2()
>
> DEFINE CLASS test as Collection
> FUNCTION Error(nError, cMethod, nLine)
> ?"class error handler fired!"
> ENDFUNC
>
> FUNCTION Method1
> LOCAL y
> y=-1
> ?"Method1"
> TRY
> y = MissingVariable
> CATCH
> ?"Method1 - Catch Block Fired"
> ?""
> y = 0
> ENDTRY
> ENDFUNC
>
> FUNCTION Method2
> LOCAL y
> y=-1
> ?"Method2"
> TRY
> y = THIS.Item(1)
> CATCH
> ?"Method2 - Catch Block Fired"
> ?""
> y = 0
> ENDTRY
> ENDFUNC
>
> ENDDEFINE02
>
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to