Well, well ... thanks Dave.  But guess what? The code described below works, and works 
well (with the possible exception of the original oddity, of errors seeming to be both 
caught and not-caught at the same time).

I see from a re-reading of cfrethrow that it's supposed to do just as you said.  I 
must have missed that before, or I was reading a different description.

In my code it works quite well to cfrethrow from inside a cfcatch block and have it 
caught by the next cfcatch block - thus, I have two cfcatch type=any blocks.  Now that 
I see it's not supposed to work that way I'll see about changing, on the theory that 
it may not continue to be robust.

Another day, another peculiar ColdFusion response!

thanks,
Chris Norloff

---------- Original Message ----------------------------------
From: Dave Watts <[EMAIL PROTECTED]>
Date: Mon, 7 Jan 2002 18:07:54 -0500 

>> Thanks for the response.  Interesting observation - I AM 
>> using a rethrow in a cfcatch, though I don't think that's 
>> what's causing the problem.
>> 
>> I use a rethrow because timeout errors come in two types 
>> here: type=unknown and 
>> type=com.allaire.coldfusion.request.timeout.  I have 4 
>> cfcatch's: type=expression, type=database, type=any, type=any.  
>> 
>> Inside the first type=any I check if type=...timeout or if 
>> the first 17 characters of cfcatch.message are "Request timed 
>> out". If so, I rethrow, and the second type=any is actually 
>> the cfcatch for timeouts.
>> 
>> Since the caught type is database, I don't think this 
>> error-handling is getting to the type=any cfcatch statements.
>> 
>> We're not using cferror type=monitor, only type=exception.  
>> Though perhaps I should be using type=request to catch more 
>> things if they slip past the cfcatch's.
>
>OK. If you're doing something like this, though, I can see a potential
>problem:
>
><cftry>
>
>       <cfquery ...>
>
>       </cfquery>
>
>       <cfcatch type="database">
>       ...
>       </cfcatch>
>
>       <cfcatch type="any">
>               <cfif something>
>                       <cfrethrow>
>               </cfif>
>       </cfcatch>
>
>       <cfcatch type="any">
>       ...
>       </cfcatch>
>
></cftry>
>
>The second CFCATCH won't throw an exception to the third CFCATCH, but
>instead it'll throw it to a higher-level CFCATCH (if one exists, you'd have
>this entire CFTRY block wrapped within a CFCATCH in a larger CFTRY!) or to a
>calling page, if this is a custom tag.
>
>However, that doesn't seem to address your specific problem, which is with
>the first CFCATCH.
>
>Dave Watts, CTO, Fig Leaf Software
>http://www.figleaf.com/
>voice: (202) 797-5496
>fax: (202) 797-5444
>
______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to