> -----Original Message-----
> From: Dave Watts [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 24, 2001 1:20 PM
> To: CF-Talk
> Subject: RE: CFTRY / CFCATCH questions
> 
> 
> > that's incorrect, actually. it will catch them in the order 
> > defined. so if there is an "ALL" first, there will never be 
> > any other. basically, it starts at the first CATCH, compares 
> > exception types.  if it is a match, that handler occurs, if 
> > not, it examines the next one in order, ad nauseum, until
> > the last catch (which should probably be an "ALL" JIC)
> 
> Actually, it may or may not catch them in the order defined. It depends.
> 
> On CF 4.0.x, it will. On CF 4.5.x, by default, it won't - it'll 
> look for the
> "best fit". So, even if you've got a CFCATCH TYPE="all" at the 
> top, it won't
> use that unless that's the only one that would work. However, 
> this behavior
> can be overridden by using the CFSETTING tag's CATCHEXCEPTIONBYPATTERN
> attribute.
> 
> I'd argue that you're best off putting TYPE="all" last anyway, though.
> 
> Finally, I don't think you should have a TYPE="all" to catch anything you
> haven't foreseen, generally, unless you have some specific way to 
> deal with
> the problem. That's what the general error handlers and CFERROR
> TYPE="exception" are for.


And on another note, if you use type="ANY" instead of "ALL", it will work ;o)  Sorry, 
I couldn't resist.

I love error handling in CF, especially in 4.5+, since it's very advanced for a "tag 
based language".  One of the places it's really helped
is this drug testing application I've done.  When raw test files come from the lab, 
some may be corrupt, or some may have invalid values, especially for dates (imagine 
that...).  CFTRY/CFCATCH has been a godsend in that I loop through all of my tests and 
catch all types of errors, whether they stem from an incomplete file or a wrong 
date,identification number, etc.  I can then process each file differently and send it 
to the appropriate person for dissemination and trouble-shooting...  Most of the time, 
however, that person is me... :o|


-Andy


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to