Steve Ellenoff wrote on 2010-12-10: 
> 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..
> 

Steve,

The error is happening in the class. I remember this behavior being in the
listbox and combobox lists as well.
This is just one of the odd places it bubbles up to the class handler first.

I took the Error function out and the Try/Catch handler caught it.

Create a base, test01 with a method3 that has the y = MissingVariable line.
Keep the Error function in the base, see how it fires the ErrorHandler
instead of being caught in the try/catch.

DEFINE CLASS test01 as Collection
FUNCTION Error(nError, cMethod, nLine)
?"Method:",cMethod,"@",TRANSFORM(nLine)
?"class error handler fired!"
?""
ENDFUNC
FUNCTION Method3
y = MissingVariable
ENDFUNC 
ENDDEFINE
DEFINE CLASS test as test01
FUNCTION Method3
TRY 
?"Method3"
DODEFAULT()
CATCH 
?"Method3 - Catch Block Fired"
?""
ENDTRY 
FUNCTION Method1
...
ENDDEFINE

Tracy Pearson
PowerChurch Software




_______________________________________________
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/003701cb98af$7a79c310$6f6d49...@com
** 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